All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koba Ko <koba.ko@canonical.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	James Morse <james.morse@arm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Robert Richter <rric@kernel.org>,
	linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	Markus Elfring <Markus.Elfring@web.de>
Subject: Re: [PATCH][V2] EDAC/i10nm: shift exponent is negative
Date: Tue, 4 Jul 2023 20:32:51 +0800	[thread overview]
Message-ID: <CAJB-X+XtfBm0a4btt6NT9rvdrxETNLNMVQ3G=u513Nh8RKwjWw@mail.gmail.com> (raw)
In-Reply-To: <a0bf3b4c-a528-4507-9bd4-95a0a9eb927d@moroto.mountain>

On Tue, Jul 4, 2023 at 8:02 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> Here is a better commit message.  You can just copy and paste it.
> ------------------------------------------
> [PATCH v3] EDAC/i10nm: Prevent negative shifts in skx_get_dimm_info().
>
> UBSAN generated the following warning during a timeout:
>
>     UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16
>     shift exponent -66 is negative
>
> That most likely means that rows, cols, and ranks were all set to
> -EINVAL.  Address this in two ways.
>
> 1) Change the debug output in skx_get_dimm_attr() to KERN_ERR so that
>    users will know where exactly the error is.
> 2) Add a check for errors in skx_get_dimm_info().
>
> Fixes: 88a242c98740 ("EDAC, skx_common: Separate common code out from skx_edac")
> Signed-off-by:
> -----------------------------------------------

have sent V3 as per Markus' comments.
https://patchwork.kernel.org/project/linux-edac/patch/20230704095939.119620-1-koba.ko@canonical.com/
Thanks
>
> > @@ -351,6 +351,8 @@ int skx_get_dimm_info(u32 mtr, u32 mcmtr, u32 amap, struct dimm_info *dimm,
> >       ranks = numrank(mtr);
> >       rows = numrow(mtr);
> >       cols = imc->hbm_mc ? 6 : numcol(mtr);
> > +     if (ranks == -EINVAL || rows == -EINVAL || cols == -EINVAL)
> > +             return 0;
>
> Change this to:
>
>         if (rangks < 0 || rows < 0 || cols < 0)
>                 return 0;
>
> It's bad form to check for a specific error code unless there is a need.
>
> regards,
> dan carpenter
>

      reply	other threads:[~2023-07-04 12:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 16:25 [PATCH][V2] EDAC/i10nm: shift exponent is negative Koba Ko
     [not found] ` <4ec2b7d2-11a5-6ab6-087a-175ed31faca4@web.de>
2023-07-03 21:51   ` [PATCH v2] " Luck, Tony
2023-07-04  1:50     ` Koba Ko
2023-07-04  3:14       ` Luck, Tony
2023-07-05  4:08       ` Luck, Tony
2023-07-05  8:45         ` Koba Ko
2023-07-05 15:22           ` Luck, Tony
2023-07-06 14:11             ` Zhuo, Qiuxu
2023-07-06 17:40               ` Koba Ko
2023-07-07  3:34                 ` Zhuo, Qiuxu
2023-07-09 15:42                   ` Koba Ko
2023-07-10  1:18                     ` Zhuo, Qiuxu
2023-07-10  6:25                     ` Dan Carpenter
2023-07-10  8:08                       ` Zhuo, Qiuxu
2023-07-04  2:20     ` Koba Ko
2023-07-04  4:59       ` Koba Ko
     [not found]         ` <9c27530e-21f9-15ce-5116-5af5b0c25f53@web.de>
2023-07-04  8:05           ` Koba Ko
2023-07-04  8:17           ` Koba Ko
     [not found]             ` <706f49e8-d536-651a-2f19-394518633b53@web.de>
2023-07-04  8:59               ` [v2/v3] " Koba Ko
2023-07-04 12:02 ` [PATCH][V2] " Dan Carpenter
2023-07-04 12:32   ` Koba Ko [this message]

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='CAJB-X+XtfBm0a4btt6NT9rvdrxETNLNMVQ3G=u513Nh8RKwjWw@mail.gmail.com' \
    --to=koba.ko@canonical.com \
    --cc=Markus.Elfring@web.de \
    --cc=bp@alien8.de \
    --cc=dan.carpenter@linaro.org \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --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 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.