]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (adc128d818) Fix underflows seen when writing limit attributes
authorGuenter Roeck <linux@roeck-us.net>
Sun, 7 Jul 2024 06:43:04 +0000 (23:43 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 7 Jul 2024 14:48:25 +0000 (07:48 -0700)
commit8cad724c8537fe3e0da8004646abc00290adae40
tree17bb79f64bf483258e0ad799e9e035b0f9cbe81f
parent0811b8b03bb30b82c84283dde1ff697bc192abc0
hwmon: (adc128d818) Fix underflows seen when writing limit attributes

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>
drivers/hwmon/adc128d818.c