Commit 7015b1a3 authored by Paul Mackerras's avatar Paul Mackerras

[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.
parent db2f4e00
......@@ -13,6 +13,8 @@ typedef struct kmem_cache_s kmem_cache_t;
#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
......
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