[lm-sensors] [PATCH 51/79] hwmon: (pc87360) Fix vrm value range

Guenter Roeck guenter.roeck at ericsson.com
Tue Jan 24 03:49:30 CET 2012


When updating vrm, the value range was not limited. This could result in more or
less random vrm values if the value provided by the user was larger than 255.
Fix by limiting the range to 0..255 using the SENSORS_LIMIT macro.

Cc: Jim Cromie <jim.cromie at gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck at ericsson.com>
---
 drivers/hwmon/pc87360.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 000499e..7f95761 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -614,7 +614,7 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
 	if (err)
 		return err;
 
-	data->vrm = val;
+	data->vrm = SENSORS_LIMIT(val, 0, 255);
 	return count;
 }
 static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
-- 
1.7.3.1





More information about the lm-sensors mailing list