[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.
Showing
Please register or sign in to comment