summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1026.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-06 08:20:45 +0800
committerGuenter Roeck <linux@roeck-us.net>2014-08-05 19:44:36 -0700
commita4461647f66c6e12676f9e9ce43c1578a2ba02a1 (patch)
tree17b52b4c2b66754fe6a50a83b621207d3fd5c0cb /drivers/hwmon/adm1026.c
parent9c8ae7287a51d0fdc2e3547068afccfc4880e902 (diff)
downloadblackbird-op-linux-a4461647f66c6e12676f9e9ce43c1578a2ba02a1.tar.gz
blackbird-op-linux-a4461647f66c6e12676f9e9ce43c1578a2ba02a1.zip
hwmon: (adm1026) 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/adm1026.c')
-rw-r--r--drivers/hwmon/adm1026.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index ca8430f92564..e67b9a50ac7c 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1085,6 +1085,9 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
if (err)
return err;
+ if (val > 255)
+ return -EINVAL;
+
data->vrm = val;
return count;
}
OpenPOWER on IntegriCloud