aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-05 20:21:49 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-08-05 22:44:36 -0400
commitdb59ac434230c2d6c051bb314f320ad977e6841d (patch)
treecc744c60dd7042b99b066d876b9611579abc4c2d /drivers
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')
-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,
510 err = kstrtoul(buf, 10, &val); 510 err = kstrtoul(buf, 10, &val);
511 if (err) 511 if (err)
512 return err; 512 return err;
513
514 if (val > 255)
515 return -EINVAL;
516
513 data->vrm = val; 517 data->vrm = val;
514 return count; 518 return count;
515} 519}