mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Tony Luck <tony.luck@intel.com>, Jack Steiner <steiner@sgi.com>,
	Paul Jackson <pj@sgi.com>,
	linux-kernel@vger.kernel.org, Dan Higgins <djh@sgi.com>
Subject: [PATCH] ia64: panic if topology_init kzalloc fails
Date: Mon, 31 Jul 2006 21:14:33 -0700	[thread overview]
Message-ID: <20060801041433.23919.69026.sendpatchset@jackhammer.engr.sgi.com> (raw)

From: Paul Jackson <pj@sgi.com>

There really is no sense trying to continue if the kzalloc of
sysfs_cpus[] fails in ia64 topology_init.  The code calling
into here doesn't check errors very well, and one ends up with
a nonobvious boot failure that wastes peoples time debugging.

See for example the lkml thread at:
  http://lkml.org/lkml/2006/3/2/215

Since the system is totally dead when this kzalloc fails, not
having yet even booted, might as well announce one's death
boldly and plainly.

Signed-off-by: Paul Jackson <pj@sgi.com>

---

 arch/ia64/kernel/topology.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- 2.6.18-rc2-mm1.orig/arch/ia64/kernel/topology.c	2006-07-31 17:18:04.921717318 -0700
+++ 2.6.18-rc2-mm1/arch/ia64/kernel/topology.c	2006-07-31 21:12:08.950508732 -0700
@@ -67,10 +67,8 @@ static int __init topology_init(void)
 #endif
 
 	sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
-	if (!sysfs_cpus) {
-		err = -ENOMEM;
-		goto out;
-	}
+	if (!sysfs_cpus)
+		panic("kzalloc in topology_init failed - NR_CPUS too big?");
 
 	for_each_present_cpu(i) {
 		if((err = arch_register_cpu(i)))

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

                 reply	other threads:[~2006-08-01  4:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060801041433.23919.69026.sendpatchset@jackhammer.engr.sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=djh@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steiner@sgi.com \
    --cc=tony.luck@intel.com \
    /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

Powered by JetHome