The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] slab: Adds two missing kmalloc() checks.
@ 2006-01-23 15:31 Luiz Fernando Capitulino
  2006-01-23 16:38 ` Pekka Enberg
  0 siblings, 1 reply; 6+ messages in thread
From: Luiz Fernando Capitulino @ 2006-01-23 15:31 UTC (permalink / raw)
  To: akpm; +Cc: lkml, penberg


 Adds two missing kmalloc() checks in kmem_cache_init(). The check is worth
because if kmalloc() fails we'll have a nice message instead of a OOPS (which
will make us look for a bug).

 We're using BUG_ON() so that embedded people can disable it.

Signed-off-by: Luiz Capitulino <lcapitulino@mandriva.com.br>

 mm/slab.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/slab.c b/mm/slab.c
index 6f8495e..2fcfd08 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1130,6 +1130,7 @@ void __init kmem_cache_init(void)
 		void *ptr;
 
 		ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
+		BUG_ON(!ptr);
 
 		local_irq_disable();
 		BUG_ON(ac_data(&cache_cache) != &initarray_cache.cache);
@@ -1139,6 +1140,7 @@ void __init kmem_cache_init(void)
 		local_irq_enable();
 
 		ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
+		BUG_ON(!ptr);
 
 		local_irq_disable();
 		BUG_ON(ac_data(malloc_sizes[INDEX_AC].cs_cachep)


-- 
Luiz Fernando N. Capitulino

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-01-23 17:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-23 15:31 [PATCH] slab: Adds two missing kmalloc() checks Luiz Fernando Capitulino
2006-01-23 16:38 ` Pekka Enberg
2006-01-23 16:44   ` Arjan van de Ven
2006-01-23 16:52     ` Pekka Enberg
2006-01-23 17:01       ` Luiz Fernando Capitulino
2006-01-23 17:06         ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox