[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130720055544.73a7315d.mchehab@infradead.org>
Date: Sat, 20 Jul 2013 05:55:44 +0300
From: Mauro Carvalho Chehab <mchehab@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: "Luck, Tony" <tony.luck@...el.com>,
Markus Trippelsdorf <markus@...ppelsdorf.de>,
Ming Lei <tom.leiming@...il.com>, Linda Walsh <lkml@...nx.org>,
Linux-Kernel <linux-kernel@...r.kernel.org>,
Doug Thompson <dougthompson@...ssion.com>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>
Subject: Re: BUG: key ffff880c1148c478 not in .data! (V3.10.0)
Em Fri, 19 Jul 2013 01:27:18 +0200
Borislav Petkov <bp@...en8.de> escreveu:
> 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:
With this change, the patch looks ok for me.
Acked-by: Mauro Carvalho Chehab <m.chehab@...sung.com>
>
> 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.
>
Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists