Messages in this thread Patch in this message | | | Date | Sun, 15 Jun 2003 12:28:05 +1000 | From | Paul Mackerras <> | Subject | [PATCH] fix weird kmalloc bug |
| |
Last night, Manfred and I found an interesting bug with kmalloc on ppc32, where the kmalloc in alloc_super() (fs/super.c) was requesting 432 bytes but only getting 256 bytes. The reason was that PAGE_SIZE wasn't defined at the point where the kmalloc() inline function occurs. Thus the CACHE(32) entry got omitted from the list in kmalloc_sizes.h, and kmalloc therefore used the entry in malloc_sizes[] before the correct entry.
This patch fixes it by including asm/page.h and asm/cache.h in linux/slab.h. The list in kmalloc_sizes.h depends on L1_CACHE_BYTES as well as PAGE_SIZE, which is why I added asm/cache.h.
Paul.
diff -urN linux-2.5/include/linux/slab.h pmac-2.5-smp/include/linux/slab.h --- linux-2.5/include/linux/slab.h 2003-06-12 10:43:55.000000000 +1000 +++ pmac-2.5/include/linux/slab.h 2003-06-14 22:16:14.000000000 +1000 @@ -13,6 +13,8 @@ #include <linux/gfp.h> #include <linux/types.h> +#include <asm/page.h> +#include <asm/cache.h> /* flags for kmem_cache_alloc() */ #define SLAB_NOFS GFP_NOFS - 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/
| |