kmalloc() fix^2

David Mosberger (davidm@napali.hpl.hp.com)
Thu, 10 Apr 2003 14:50:50 -0700


It's all very embarassing, but my previous patch was horribly broken:
it added the NULL terminator to the wrong array... Of course, adding
it to the correct array uncovered another bug... ;-(

Patch below fixes both problems. Reall, I mean it.

Andrew, you may want to double-check---I didn't look through all of
slab.c whether there might be problems (there was no other mention of
ARRAY_SIZE(malloc_sizes) though.

Thanks,

--david

===== mm/slab.c 1.74 vs edited =====
--- 1.74/mm/slab.c Wed Apr 9 13:28:18 2003
+++ edited/mm/slab.c Thu Apr 10 14:43:44 2003
@@ -383,6 +383,7 @@
} malloc_sizes[] = {
#define CACHE(x) { .cs_size = (x) },
#include <linux/kmalloc_sizes.h>
+ {0, }
#undef CACHE
};

@@ -393,7 +394,6 @@
} cache_names[] = {
#define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
#include <linux/kmalloc_sizes.h>
- { 0, }
#undef CACHE
};

@@ -604,7 +604,7 @@
if (num_physpages > (32 << 20) >> PAGE_SHIFT)
slab_break_gfp_order = BREAK_GFP_ORDER_HI;

- for (i = 0; i < ARRAY_SIZE(malloc_sizes); i++) {
+ for (i = 0; i < ARRAY_SIZE(malloc_sizes) - 1; i++) {
struct cache_sizes *sizes = malloc_sizes + i;
/* For performance, all the general caches are L1 aligned.
* This should be particularly beneficial on SMP boxes, as it
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/