All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 79/79] hwmon: (it87) Fix vrm value range
@ 2012-01-24  2:49 Guenter Roeck
  2012-01-24  8:50 ` Jean Delvare
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Guenter Roeck @ 2012-01-24  2:49 UTC (permalink / raw)
  To: lm-sensors

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: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
---
 drivers/hwmon/it87.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0b204e4..bd8775c 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1324,7 +1324,7 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
 	if (kstrtoul(buf, 10, &val) < 0)
 		return -EINVAL;
 
-	data->vrm = val;
+	data->vrm = SENSORS_LIMIT(val, 0, 255);
 
 	return count;
 }
-- 
1.7.3.1


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-01-27  8:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24  2:49 [lm-sensors] [PATCH 79/79] hwmon: (it87) Fix vrm value range Guenter Roeck
2012-01-24  8:50 ` Jean Delvare
2012-01-24 14:47 ` Guenter Roeck
2012-01-24 15:11 ` Guenter Roeck
2012-01-24 18:47 ` Guenter Roeck
2012-01-24 19:49 ` Jean Delvare
2012-01-24 20:34 ` Guenter Roeck
2012-01-25 10:01 ` Jean Delvare
2012-01-25 10:17 ` Jean Delvare
2012-01-25 10:31 ` Guenter Roeck
2012-01-26 21:03 ` Jean Delvare
2012-01-26 21:53 ` Guenter Roeck
2012-01-27  8:32 ` Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.