diff options
| author | Axel Lin <axel.lin@ingics.com> | 2014-08-05 20:28:02 -0400 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-05 22:44:42 -0400 |
| commit | fe04f24b831cf384eda9798e1af642b96ca19d29 (patch) | |
| tree | c17cc9942e42391da0cc6842878b321a439af691 | |
| parent | 970255b75d0b54e457091182a7ae3a188ac0c346 (diff) | |
hwmon: (w83791d) 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>
| -rw-r--r-- | drivers/hwmon/w83791d.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c index cb3765fec98c..001df856913f 100644 --- a/drivers/hwmon/w83791d.c +++ b/drivers/hwmon/w83791d.c | |||
| @@ -1181,6 +1181,9 @@ static ssize_t store_vrm_reg(struct device *dev, | |||
| 1181 | if (err) | 1181 | if (err) |
| 1182 | return err; | 1182 | return err; |
| 1183 | 1183 | ||
| 1184 | if (val > 255) | ||
| 1185 | return -EINVAL; | ||
| 1186 | |||
| 1184 | data->vrm = val; | 1187 | data->vrm = val; |
| 1185 | return count; | 1188 | return count; |
| 1186 | } | 1189 | } |
