]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwmon: (lm95234) Fix underflows seen when writing limit attributes
authorGuenter Roeck <linux@roeck-us.net>
Sun, 7 Jul 2024 06:48:42 +0000 (23:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:11:36 +0000 (11:11 +0200)
commit46e4fd338d5bdbaf60e41cda625b24949d2af201
tree02b42191696091166d67b3aa5a74688f47dc7cbc
parent6891b11a0c6227ca7ed15786928a07b1c0e4d4af
hwmon: (lm95234) Fix underflows seen when writing limit attributes

[ Upstream commit af64e3e1537896337405f880c1e9ac1f8c0c6198 ]

DIV_ROUND_CLOSEST() after kstrtol() results in an underflow if a large
negative number such as -9223372036854775808 is provided by the user.
Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/lm95234.c