Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e36ce99e authored by Guenter Roeck's avatar Guenter Roeck
Browse files

hwmon: (ds620) Fix overflows seen when writing temperature limits



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: default avatarJean Delvare <jdelvare@suse.de>
Fixes: 60994698 ("hwmon: Support for Dallas Semiconductor DS620")
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 0fb620c4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;