diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-11-20 21:37:39 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 13:22:48 +0300 |
commit | 5e351caeaa96f1eafb527b4606535745fcce6577 (patch) | |
tree | 89e2e66461421cf7ab85eb8cd6759d9d60750f02 /drivers/hwmon | |
parent | fbab1832e7e824fe8b588de68914641ac1d61b40 (diff) | |
download | linux-5e351caeaa96f1eafb527b4606535745fcce6577.tar.xz |
hwmon: (ds620) Fix overflows seen when writing temperature limits
commit e36ce99ee0815d7919a7b589bfb66f3de50b6bc7 upstream.
Module test reports:
temp1_max: Suspected overflow: [160000 vs. 0]
temp1_min: Suspected overflow: [160000 vs. 0]
This is seen because the values passed when writing temperature limits
are unbound.
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Fixes: 6099469805c2 ("hwmon: Support for Dallas Semiconductor DS620")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/ds620.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c index edf550fc4eef..0043a4c02b85 100644 --- a/drivers/hwmon/ds620.c +++ b/drivers/hwmon/ds620.c @@ -166,7 +166,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, if (res) return res; - val = (val * 10 / 625) * 8; + val = (clamp_val(val, -128000, 128000) * 10 / 625) * 8; mutex_lock(&data->update_lock); data->temp[attr->index] = val; |