public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>,
	Ming Lei <tom.leiming@gmail.com>, Linda Walsh <lkml@tlinx.org>,
	Linux-Kernel <linux-kernel@vger.kernel.org>,
	Doug Thompson <dougthompson@xmission.com>,
	"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
Subject: Re: BUG: key ffff880c1148c478 not in .data! (V3.10.0)
Date: Fri, 19 Jul 2013 01:27:18 +0200	[thread overview]
Message-ID: <20130718232718.GA14824@pd.tnic> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F31C92B23@ORSMSX106.amr.corp.intel.com>

On Thu, Jul 18, 2013 at 04:51:48PM +0000, Luck, Tony wrote:
> +	BUG_ON(mci->mc_idx >= EDAC_MAX_MCS);
> 
> Do we have to "BUG_ON()" here?  Couldn't we be gentler with something like:
> 
> 	if (mci->mc_idx >= EDAC_MAX_MCS) {
> 		printk_once(KERN_WARNING "Too many memory controllers\n");
> 		return; /* probably need to make sure caller copes with this ... so more stuff there */

Yeah, we can do something like this:

diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 429e971e02d7..c55ad285c285 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -725,6 +725,11 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
 	int ret = -EINVAL;
 	edac_dbg(0, "\n");
 
+	if (mci->mc_idx >= EDAC_MAX_MCS) {
+		pr_warn_once("Too many memory controllers: %d\n", mci->mc_idx);
+		return ret;
+	}
+
 #ifdef CONFIG_EDAC_DEBUG
 	if (edac_debug_level >= 3)
 		edac_mc_dump_mci(mci);
--

right near the beginning of the function so that we can save us the
unwinding.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2013-07-18 23:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 22:25 Fwd: BUG: key ffff880c1148c478 not in .data! (V3.10.0) Linda Walsh
2013-07-12  2:19 ` Ming Lei
2013-07-12  8:04   ` Markus Trippelsdorf
2013-07-12 13:41     ` Borislav Petkov
2013-07-12 13:57       ` Mauro Carvalho Chehab
2013-07-12 14:21         ` Borislav Petkov
2013-07-12 16:13           ` Mauro Carvalho Chehab
2013-07-12 16:19             ` Luck, Tony
2013-07-18 16:42               ` Borislav Petkov
2013-07-18 16:51                 ` Luck, Tony
2013-07-18 23:27                   ` Borislav Petkov [this message]
2013-07-19 10:28                     ` [PATCH -v2] EDAC: Fix lockdep splat Borislav Petkov
2013-07-20  3:55                       ` Mauro Carvalho Chehab
2013-07-20  2:55                     ` BUG: key ffff880c1148c478 not in .data! (V3.10.0) Mauro Carvalho Chehab
2013-07-12 14:28       ` Markus Trippelsdorf
2013-07-12 14:36         ` Borislav Petkov

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=20130718232718.GA14824@pd.tnic \
    --to=bp@alien8.de \
    --cc=dougthompson@xmission.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@tlinx.org \
    --cc=markus@trippelsdorf.de \
    --cc=mchehab@infradead.org \
    --cc=tom.leiming@gmail.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