From: Axel Lin Date: Wed, 6 Aug 2014 00:28:02 +0000 (+0800) Subject: hwmon: (w83791d) Fix vrm write operation X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fe04f24b831cf384eda9798e1af642b96ca19d29;p=linux-beck.git 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 Signed-off-by: Guenter Roeck --- 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, if (err) return err; + if (val > 255) + return -EINVAL; + data->vrm = val; return count; }