[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJB-X+XtfBm0a4btt6NT9rvdrxETNLNMVQ3G=u513Nh8RKwjWw@mail.gmail.com>
Date: Tue, 4 Jul 2023 20:32:51 +0800
From: Koba Ko <koba.ko@...onical.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Borislav Petkov <bp@...en8.de>, Tony Luck <tony.luck@...el.com>,
James Morse <james.morse@....com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Robert Richter <rric@...nel.org>, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org,
Markus Elfring <Markus.Elfring@....de>
Subject: Re: [PATCH][V2] EDAC/i10nm: shift exponent is negative
On Tue, Jul 4, 2023 at 8:02 PM Dan Carpenter <dan.carpenter@...aro.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
>
Powered by blists - more mailing lists