hwmon: (jc42) Fix integer overflow
Guenter Roeck
maintainerPATCH 2/2 hwmon: (jc42) Fix integer overflow
Mixed use of long and int caused an integer overflow when writing large limits.
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/hwmon/jc42.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/jc42.c +1 -1
@@ -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 :
Signature · 7 lines
2.1.0 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
Quoted 12 lines · Guenter Roeck
Mixed use of long and int caused an integer overflow when writing large limits.
Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/jc42.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/jc42.c +0
-0
drivers/hwmon/jc42.c struct jc42_data { · line 207
Quoted 8 lines
drivers/hwmon/jc42.c +1
-1@@ -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 :
Good catch.
Reviewed-by Jean Delvare <[email protected]>
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors