@@ -330,7 +330,7 @@ static int skx_get_dimm_attr(u32 reg, int lobit, int hibit, int add,
u32 val = GET_BITFIELD(reg, lobit, hibit);
if (val < minval || val > maxval) {
- edac_dbg(2, "bad %s = %d (raw=0x%x)\n", name, val, reg);
+ skx_printk(KERN_ERR, "bad %s = %d (raw=0x%x)\n", name, val, reg);
return -EINVAL;
}
return val + add;
@@ -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;
if (imc->hbm_mc) {
banks = 32;
A surprising value was determined after a read failure from a DIMM. Software analyses pointed a data processing issue out. `UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16 shift exponent -66 is negative` A special value combination could not be handled so far. Check if an invalid value was detected by a call of the function “skx_get_dimm_attr”. * Print a corresponding error message in this case. * Return zero then directly from the function “skx_get_dimm_info”. Fixes: 4ec656bdf43a ("EDAC, skx_edac: Add EDAC driver for Skylake") Signed-off-by: Koba Ko <koba.ko@canonical.com> --- v3: According to Markus' comments, simplify and polish the summary and add `Fixes:` v2: make error-print explicitly drivers/edac/skx_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)