summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-06 08:21:49 +0800
committerGuenter Roeck <linux@roeck-us.net>2014-08-05 19:44:36 -0700
commitdb59ac434230c2d6c051bb314f320ad977e6841d (patch)
treecc744c60dd7042b99b066d876b9611579abc4c2d /drivers/hwmon
parenta4461647f66c6e12676f9e9ce43c1578a2ba02a1 (diff)
hwmon: (asb100) Fix vrm write operation
vrm is an u8, so the written value needs to be limited to [0, 255]. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/asb100.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c
index f96063680e58..272fcc837ecc 100644
--- a/drivers/hwmon/asb100.c
+++ b/drivers/hwmon/asb100.c
@@ -510,6 +510,10 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
err = kstrtoul(buf, 10, &val);
if (err)
return err;
+
+ if (val > 255)
+ return -EINVAL;
+
data->vrm = val;
return count;
}