diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-12-04 18:15:25 -0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-12-12 11:32:34 -0800 |
commit | c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf (patch) | |
tree | 3b425cece8455b70bdb0e3641c4084ba2d863c3a /drivers/hwmon/lm87.c | |
parent | 64bd708ae0edced5eee764c2321b280bc1e16550 (diff) | |
download | linux-c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf.tar.gz linux-c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf.tar.bz2 linux-c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf.zip |
hwmon: (nct7802) Fix overflows seen when writing into limit attributes
Fix overflows seen when writing voltage and temperature limit attributes.
The value passed to DIV_ROUND_CLOSEST() needs to be clamped, and the
value parameter passed to nct7802_write_fan_min() is an unsigned long.
Also, writing values larger than 2700000 into a fan limit attribute results
in writing 0 into the chip's limit registers. The exact behavior when
writing this value is unspecified. For consistency, report a limit of
1350000 if the chip register reads 0. This may be wrong, and the chip
behavior should be verified with the actual chip, but it is better than
reporting a value of 0 (which, when written, results in writing a value
of 0x1fff into the chip register).
Fixes: 3434f3783580 ("hwmon: Driver for Nuvoton NCT7802Y")
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/lm87.c')
0 files changed, 0 insertions, 0 deletions