From: sashiko-bot@kernel.org
To: "Nikita Zhandarovich" <n.zhandarovich@fintech.ru>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2] hwmon: it87: Clamp negative values to zero in set_fan()
Date: Fri, 29 May 2026 14:58:21 +0000 [thread overview]
Message-ID: <20260529145821.6D2D21F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260529141839.1639287-1-n.zhandarovich@fintech.ru>
> set_fan() parses user input with kstrtol() and passes the resulting
> value to FAN16_TO_REG() on chips with 16-bit fan support.
>
> Negative fan speeds are not meaningful and should be rejected before
> conversion. Worst scenario, one may be able to abuse undefined
> behaviour of signed overflow to possibly induce rpm * 2 == 0 in
> FAN16_TO_REG(), thus causing a division by zero.
>
> Instead, clamp val < 0 to zero and keep the conversion in its valid
> input domain, avoiding unsafe arithmetic in the register conversion
> path.
>
> Found by Linux Verification Center (linuxtesting.org) with static
> analysis tool SVACE.
>
> Fixes: 17d648bf5786 ("it87: Add support for the IT8716F")
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260529141839.1639287-1-n.zhandarovich@fintech.ru?part=1
next prev parent reply other threads:[~2026-05-29 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 14:18 [PATCH v2] hwmon: it87: Clamp negative values to zero in set_fan() Nikita Zhandarovich
2026-05-29 14:58 ` sashiko-bot [this message]
2026-06-08 0:24 ` Guenter Roeck
2026-06-08 9:15 ` David Laight
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=20260529145821.6D2D21F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=n.zhandarovich@fintech.ru \
--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