diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-08-06 02:21:49 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-06 04:44:36 +0200 |
commit | db59ac434230c2d6c051bb314f320ad977e6841d (patch) | |
tree | cc744c60dd7042b99b066d876b9611579abc4c2d /drivers/hwmon/asb100.c | |
parent | hwmon: (adm1026) Fix vrm write operation (diff) | |
download | linux-db59ac434230c2d6c051bb314f320ad977e6841d.tar.xz linux-db59ac434230c2d6c051bb314f320ad977e6841d.zip |
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/hwmon/asb100.c')
-rw-r--r-- | drivers/hwmon/asb100.c | 4 |
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, err = kstrtoul(buf, 10, &val); if (err) return err; + + if (val > 255) + return -EINVAL; + data->vrm = val; return count; } |