summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-01-19 02:29:32 +0100
committerGuenter Roeck <linux@roeck-us.net>2015-01-26 06:23:59 +0100
commit3a05633b042fb4aea65b09ce2d0d43689df6eb9a (patch)
tree0e69b76135ece3baa6f90ddf6cd5c211ac1bfc7c /drivers/hwmon
parenthwmon: (jc42) Use sign_extend32 for sign extension (diff)
downloadlinux-3a05633b042fb4aea65b09ce2d0d43689df6eb9a.tar.xz
linux-3a05633b042fb4aea65b09ce2d0d43689df6eb9a.zip
hwmon: (jc42) Fix integer overflow
Mixed use of long and int caused an integer overflow when writing large limits. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/jc42.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c
index 262d8086822f..f8e3bbbf019c 100644
--- a/drivers/hwmon/jc42.c
+++ b/drivers/hwmon/jc42.c
@@ -201,7 +201,7 @@ struct jc42_data {
#define JC42_TEMP_MIN 0
#define JC42_TEMP_MAX 125000
-static u16 jc42_temp_to_reg(int temp, bool extended)
+static u16 jc42_temp_to_reg(long temp, bool extended)
{
int ntemp = clamp_val(temp,
extended ? JC42_TEMP_MIN_EXTENDED :