mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Koba Ko <koba.ko@canonical.com>
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
Subject: Re: [PATCH][V2] EDAC/i10nm: shift exponent is negative
Date: Tue, 4 Jul 2023 15:02:23 +0300	[thread overview]
Message-ID: <a0bf3b4c-a528-4507-9bd4-95a0a9eb927d@moroto.mountain> (raw)
In-Reply-To: <20230703162509.77828-1-koba.ko@canonical.com>

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


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

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03 16:25 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 ` Dan Carpenter [this message]
2023-07-04 12:32   ` [PATCH][V2] " Koba Ko

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=a0bf3b4c-a528-4507-9bd4-95a0a9eb927d@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=koba.ko@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®