[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0bf3b4c-a528-4507-9bd4-95a0a9eb927d@moroto.mountain>
Date: Tue, 4 Jul 2023 15:02:23 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Koba Ko <koba.ko@...onical.com>
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
Subject: Re: [PATCH][V2] EDAC/i10nm: shift exponent is negative
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:
-----------------------------------------------
> @@ -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