Commit 7ffbbaf2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] null-terminate the kmalloc tables

From: David Mosberger <davidm@napali.hpl.hp.com>

The cache_sizes array needs to be NULL terminated, otherwise an oversized
kmalloc request runs off the end of the table.
parent 545e7a03
...@@ -387,14 +387,15 @@ static struct cache_sizes { ...@@ -387,14 +387,15 @@ static struct cache_sizes {
}; };
/* Must match cache_sizes above. Out of line to keep cache footprint low. */ /* Must match cache_sizes above. Out of line to keep cache footprint low. */
static struct { static struct {
char *name; char *name;
char *name_dma; char *name_dma;
} cache_names[] = { } cache_names[] = {
#define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" }, #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
#include <linux/kmalloc_sizes.h> #include <linux/kmalloc_sizes.h>
{ 0, }
#undef CACHE #undef CACHE
}; };
struct arraycache_init initarray_cache __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} }; struct arraycache_init initarray_cache __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
struct arraycache_init initarray_generic __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} }; struct arraycache_init initarray_generic __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment