summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-06 08:19:43 +0800
committerGuenter Roeck <linux@roeck-us.net>2014-08-05 19:44:36 -0700
commit9c8ae7287a51d0fdc2e3547068afccfc4880e902 (patch)
treed8c9a0b7de51defda9f88307496f6fb17fa20998 /drivers/hwmon
parenteeeafd384f2f1709d48ba00c807e86d4890cf6b5 (diff)
downloadlinux-9c8ae7287a51d0fdc2e3547068afccfc4880e902.tar.bz2
hwmon: (adm1025) 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/adm1025.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c
index d3d0e8cf27b4..d6c767ace916 100644
--- a/drivers/hwmon/adm1025.c
+++ b/drivers/hwmon/adm1025.c
@@ -382,6 +382,9 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
if (err)
return err;
+ if (val > 255)
+ return -EINVAL;
+
data->vrm = val;
return count;
}