From: "Nuno Sá" <noname.nuno@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, nuno.sa@analog.com
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [bug report] hwmon: ltc4282: add support for the LTC4282 chip
Date: Wed, 07 Feb 2024 11:19:04 +0100 [thread overview]
Message-ID: <53e0e2c7bb9cafb4efa3748ecf3ec765c262db83.camel@gmail.com> (raw)
In-Reply-To: <b6fb236a-c3c1-4c5c-94bd-1f68b5aeac41@moroto.mountain>
Hi Dan,
On Wed, 2024-02-07 at 12:51 +0300, Dan Carpenter wrote:
> Hello Nuno Sa,
>
> The patch 848a5019ded5: "hwmon: ltc4282: add support for the LTC4282
> chip" from Jan 29, 2024 (linux-next), leads to the following Smatch
> static checker warning:
>
> drivers/hwmon/ltc4282.c:732 ltc4282_write_voltage_byte_cached()
> warn: no lower bound on 'val' rl='s64min-4294967294'
>
> drivers/hwmon/ltc4282.c
> 723 static int ltc4282_write_voltage_byte_cached(const struct
> ltc4282_state *st,
> 724 u32 reg, u32 fs, long
> val,
> 725 u32 *cache_raw)
> 726 {
> 727 u32 in;
> 728
> 729 if (val >= fs)
> 730 in = U8_MAX;
> 731 else
> --> 732 in = DIV_ROUND_CLOSEST(val * U8_MAX, fs);
Yeah, I guess we should likely clamp it between 0 and fs
- Nuno Sá
next prev parent reply other threads:[~2024-02-07 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 9:51 [bug report] hwmon: ltc4282: add support for the LTC4282 chip Dan Carpenter
2024-02-07 10:19 ` Nuno Sá [this message]
2024-02-07 16:49 ` Guenter Roeck
2024-02-08 8:12 ` Nuno Sá
2024-02-08 14:19 ` Guenter Roeck
2024-02-08 15:22 ` 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=53e0e2c7bb9cafb4efa3748ecf3ec765c262db83.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=nuno.sa@analog.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