[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <255113ec53e3e3bb41719242ddc20c5f78e670c7.1485514374.git.jslaby@suse.cz>
Date: Fri, 27 Jan 2017 11:54:11 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>,
Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 118/235] hwmon: (ds620) Fix overflows seen when writing temperature limits
From: Guenter Roeck <linux@...ck-us.net>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
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@...e.de>
Fixes: 6099469805c2 ("hwmon: Support for Dallas Semiconductor DS620")
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
drivers/hwmon/ds620.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c
index 0918b9136588..2a50ab613238 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;
--
2.11.0
Powered by blists - more mailing lists