From: Axel Lin Date: Wed, 6 Aug 2014 00:28:46 +0000 (+0800) Subject: hwmon: (w83793) Fix vrm write operation X-Git-Tag: firefly_0821_release~176^2~3393^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2aeee04df8e0ea4d5b91da630687af1a1d93c941;p=firefly-linux-kernel-4.4.55.git hwmon: (w83793) Fix vrm write operation vrm is an u8, so the written value needs to be limited to [0, 255]. Signed-off-by: Axel Lin Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c index 9d63d71214ca..816aa6caf5d5 100644 --- a/drivers/hwmon/w83793.c +++ b/drivers/hwmon/w83793.c @@ -353,6 +353,9 @@ store_vrm(struct device *dev, struct device_attribute *attr, if (err) return err; + if (val > 255) + return -EINVAL; + data->vrm = val; return count; }