mm/slab.c: check kmalloc() return value.
PATCH 1/1 mm/slab.c: check kmalloc() return value.
Description: Check the return value of kmalloc() in function setup_cpu_cache(), in file mm/slab.c.
mm/slab.c +1 -0
@@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c }else { cachep->array[smp_processor_id ()] =kmalloc (sizeof (struct arraycache_init ),GFP_KERNEL ); +BUG_ON (!cachep->array[smp_processor_id ()]);if (g_cpucache_up ==PARTIAL_AC ) {set_up_list3s (cachep,SIZE_L3 );
Quoted 9 lines · Amit Choudhary
Description: Check the return value of
kmalloc()in functionsetup_cpu_cache(), in filemm/slab.c.Signed-off-by Amit Choudhary <[email protected]>mm/slab.c +0
-0
mm/slab.c static int setup_cpu_cache(struct kmem_c · line 2027
Quoted 7 lines
mm/slab.c +1
-0@@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c }else { cachep->array[smp_processor_id ()] =kmalloc (sizeof (struct arraycache_init ),GFP_KERNEL ); +BUG_ON (!cachep->array[smp_processor_id ()]);if (g_cpucache_up ==PARTIAL_AC ) {set_up_list3s (cachep,SIZE_L3 );
Any reason to BUG instead of trying to return as gracefully as possible?
Josef "Jeff" Sipek.
Signature · 2 lines
My public GPG key can be found at http://www.josefsipek.net/gpg/public-0xC7958FFE.txt
Quoted 15 lines · Josef Sipek
Quoted 14 lines · Amit Choudhary
Description: Check the return value of
kmalloc()in functionsetup_cpu_cache(), in filemm/slab.c.Signed-off-by Amit Choudhary <[email protected]>mm/slab.c +1
-0@@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c }else { cachep->array[smp_processor_id ()] =kmalloc (sizeof (struct arraycache_init ),GFP_KERNEL ); +BUG_ON (!cachep->array[smp_processor_id ()]);
Quoted 4 lines
mm/slab.c static int setup_cpu_cache(struct kmem_c · line 2027
Quoted 2 lines
mm/slab.c +0
-0if (g_cpucache_up ==PARTIAL_AC ) {set_up_list3s (cachep,SIZE_L3 );Any reason to BUG instead of trying to return as gracefully as possible?
If we fail to allocate memory this early in boot, we're hosed anyway.
Dave
Signature · 1 line
http://www.codemonkey.org.uk
mm/slab.c static int setup_cpu_cache(struct kmem_c · line 2027
Quoted 12 lines · Amit Choudhary
mm/slab.c +1
-0@@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c }else { cachep->array[smp_processor_id ()] =kmalloc (sizeof (struct arraycache_init ),GFP_KERNEL ); +BUG_ON (!cachep->array[smp_processor_id ()]);if (g_cpucache_up ==PARTIAL_AC ) {set_up_list3s (cachep,SIZE_L3 );
Looks good. You might want to send this to [email protected] directly.