]> git.hungrycats.org Git - linux/commitdiff
[PATCH] null-terminate the kmalloc tables
authorAndrew Morton <akpm@digeo.com>
Wed, 9 Apr 2003 04:29:49 +0000 (21:29 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 9 Apr 2003 04:29:49 +0000 (21:29 -0700)
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.

mm/slab.c

index 8830f4ed44f0e44553f8c66736584b687d5a42ec..e788a0e3a09e7feef0c7421343524f64adcd3bb4 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -387,14 +387,15 @@ static struct cache_sizes {
 };
 
 /* Must match cache_sizes above. Out of line to keep cache footprint low. */
-static struct { 
-       char *name; 
+static struct {
+       char *name;
        char *name_dma;
-} cache_names[] = { 
+} cache_names[] = {
 #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
 #include <linux/kmalloc_sizes.h>
+       { 0, }
 #undef CACHE
-}; 
+};
 
 struct arraycache_init initarray_cache __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };
 struct arraycache_init initarray_generic __initdata = { { 0, BOOT_CPUCACHE_ENTRIES, 1, 0} };