Loading
hwmon: (adc128d818) Fix underflows seen when writing limit attributes
stable inclusion from stable-v5.10.226 commit 2a3add62f183459a057336381ef3a896da01ce38 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=2a3add62f183459a057336381ef3a896da01ce38 -------------------------------- [ 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> (cherry picked from commit 86bfd73a)