mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luiz Fernando Capitulino <lcapitulino@mandriva.com.br>
To: akpm <akpm@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>, penberg@cs.helsinki.fi
Subject: [PATCH] slab: Adds two missing kmalloc() checks.
Date: Mon, 23 Jan 2006 13:31:21 -0200	[thread overview]
Message-ID: <20060123133121.70f2cbcb.lcapitulino@mandriva.com.br> (raw)


 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

             reply	other threads:[~2006-01-23 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-23 15:31 Luiz Fernando Capitulino [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060123133121.70f2cbcb.lcapitulino@mandriva.com.br \
    --to=lcapitulino@mandriva.com.br \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®