Skip to contentSkip to conversation

hwmon: (smsc47m192) Fix vrm value range

PATCH Superseded Guenter Roeck 1 participant 1 message Jan 24, 2012 Hardware monitoring

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 12/79 hwmon: (smsc47m192) Fix vrm value range

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.

---
 drivers/hwmon/smsc47m192.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/smsc47m192.c +1 -1
index 4705a8b..1e53028 100644
@@ -385,7 +385,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);
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors