All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <mita@miraclelinux.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, Pekka Enberg <penberg@cs.helsinki.fi>
Subject: [PATCH] check return value of kmalloc() in setup_cpu_cache()
Date: Sun, 13 Aug 2006 18:16:54 +0800	[thread overview]
Message-ID: <20060813101654.GB8703@miraclelinux.com> (raw)

This patch makes crash happen when allocation of cpucache data fails
in setup_cpu_cache(). It is a bit better than getting kernel NULL
pointer dereference later.

CC: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>

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

Index: work-failmalloc/mm/slab.c
===================================================================
--- work-failmalloc.orig/mm/slab.c
+++ work-failmalloc/mm/slab.c
@@ -1932,6 +1932,7 @@ static void setup_cpu_cache(struct kmem_
 	} 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);

             reply	other threads:[~2006-08-13 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-13 10:16 Akinobu Mita [this message]
2006-08-14 23:08 ` [PATCH] check return value of kmalloc() in setup_cpu_cache() Andrew Morton

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=20060813101654.GB8703@miraclelinux.com \
    --to=mita@miraclelinux.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.