diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-08-05 20:20:45 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-05 22:44:36 -0400 |
commit | a4461647f66c6e12676f9e9ce43c1578a2ba02a1 (patch) | |
tree | 17b52b4c2b66754fe6a50a83b621207d3fd5c0cb /drivers/hwmon | |
parent | 9c8ae7287a51d0fdc2e3547068afccfc4880e902 (diff) |
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')
-rw-r--r-- | drivers/hwmon/adm1026.c | 3 |
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, | |||
1085 | if (err) | 1085 | if (err) |
1086 | return err; | 1086 | return err; |
1087 | 1087 | ||
1088 | if (val > 255) | ||
1089 | return -EINVAL; | ||
1090 | |||
1088 | data->vrm = val; | 1091 | data->vrm = val; |
1089 | return count; | 1092 | return count; |
1090 | } | 1093 | } |