Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 1/3] hwmon: (ltc4282) Avoid overflow in maximum power calculation
Date: Wed, 05 Aug 2026 01:07:26 +0000	[thread overview]
Message-ID: <20260805010727.1C8191F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260805005721.1566034-2-linux@roeck-us.net>

> During device initialization in ltc4282_set_max_limits(), the calculation
> of the maximum power limit can suffer from a 32-bit integer overflow.
> 
> static int ltc4282_set_max_limits(struct ltc4282_state *st)
> {
>     ...
>     st->power_max = DIV_ROUND_CLOSEST(st->vsense_max * DECA * MILLI,
>                                       st->rsense) * st->vfs_out;
>     ...
> }
> 
> The result of DIV_ROUND_CLOSEST() evaluates to a 32-bit unsigned integer
> on 32-bit architectures. This result is then multiplied by st->vfs_out,
> which is a 16-bit unsigned integer. According to C promotion rules, since
> both operands are 32-bit or smaller, the multiplication is performed in
> [ ... ]
> 
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Fixes: cbc29538dbf7d ("hwmon: Add driver for LTC4282")
> Cc: Nuno Sa <nuno.sa@analog.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260805005721.1566034-1-linux@roeck-us.net?part=1


  reply	other threads:[~2026-08-05  1:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  0:57 [PATCH 0/3] hwmon: (ltc4282) Fix issues reported by Sashiko Guenter Roeck
2026-08-05  0:57 ` [PATCH 1/3] hwmon: (ltc4282) Avoid overflow in maximum power calculation Guenter Roeck
2026-08-05  1:07   ` sashiko-bot [this message]
2026-08-05  0:57 ` [PATCH 2/3] hwmon: (ltc4282) Clamp negative current limits Guenter Roeck
2026-08-05  1:04   ` sashiko-bot
2026-08-05  9:22   ` Nuno Sá
2026-08-05 15:41     ` Guenter Roeck
2026-08-05 16:14       ` Nuno Sá
2026-08-05 17:19         ` Guenter Roeck
2026-08-05  0:57 ` [PATCH 3/3] hwmon: (ltc4282) Fix parsing adi,current-limit-sense-microvolt Guenter Roeck
2026-08-05  1:08   ` sashiko-bot
2026-08-05  9:26 ` [PATCH 0/3] hwmon: (ltc4282) Fix issues reported by Sashiko Nuno Sá
2026-08-05 14:28   ` Guenter Roeck
2026-08-05 16:15     ` Nuno Sá

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=20260805010727.1C8191F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sashiko-reviews@lists.linux.dev \
    /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