Loading
hwmon: (adc128d818) Fix underflows seen when writing limit attributes
stable inclusion from stable-v6.6.51 commit 6891b11a0c6227ca7ed15786928a07b1c0e4d4af category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IARWHX CVE: CVE-2024-46759 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6891b11a0c6227ca7ed15786928a07b1c0e4d4af -------------------------------- [ Upstream commit 8cad724c8537fe3e0da8004646abc00290adae40 ] 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> Signed-off-by:
Chen Zhongjin <chenzhongjin@huawei.com>