linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Vadim Pasternak <vadimp@nvidia.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH hwmon-next 1/1] hwmon: (mlxreg-fan) Fix defect reported by Coverity Scan for linux-next
Date: Thu, 23 Sep 2021 18:09:18 -0700	[thread overview]
Message-ID: <20210924010918.GA3029562@roeck-us.net> (raw)
In-Reply-To: <20210920174119.1080488-1-vadimp@nvidia.com>

On Mon, Sep 20, 2021 at 08:41:18PM +0300, Vadim Pasternak wrote:
> Fix counter limit in 'for' loop in mlxreg_fan_cooling_config().
> The issue found in the report on new defect(s) introduced to linux-next
> weekly scan found with Coverity Scan - memory access violation.
> 
> ** CID 1507571:  Memory - illegal accesses  (OVERRUN)
> /drivers/hwmon/mlxreg-fan.c: 560 in mlxreg_fan_cooling_config()
> 
> >>> Overrunning array of 160 bytes at byte offset 160 by dereferencing
> 	pointer "pwm".
> 
> Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>

I just applied a similar patch. I added you as Reported-by: to that patch.

Thanks,
Guenter

> ---
>  drivers/hwmon/mlxreg-fan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/mlxreg-fan.c b/drivers/hwmon/mlxreg-fan.c
> index 35228ed112d7..feab9ec6a6ca 100644
> --- a/drivers/hwmon/mlxreg-fan.c
> +++ b/drivers/hwmon/mlxreg-fan.c
> @@ -554,7 +554,7 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
>  {
>  	int i, j;
>  
> -	for (i = 0; i <= MLXREG_FAN_MAX_PWM; i++) {
> +	for (i = 0; i < MLXREG_FAN_MAX_PWM; i++) {
>  		struct mlxreg_fan_pwm *pwm = &fan->pwm[i];
>  
>  		if (!pwm->connected)

      reply	other threads:[~2021-09-24  1:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 17:41 [PATCH hwmon-next 1/1] hwmon: (mlxreg-fan) Fix defect reported by Coverity Scan for linux-next Vadim Pasternak
2021-09-24  1:09 ` Guenter Roeck [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=20210924010918.GA3029562@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=vadimp@nvidia.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;
as well as URLs for NNTP newsgroup(s).