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

[ Upstream commit 0403e10bf0824bf0ec2bb135d4cf1c0cc3bf4bf0 ]

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/nct6775-core.c