hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
Guenter Roeck
maintainerPATCH 1/1 hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
Writing a large value into a voltage limit attribute can result in an overflow due to an auto-conversion from unsigned long to unsigned int.
--- drivers/hwmon/nct7802.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/nct7802.c +1 -1
@@ -262,7 +262,7 @@ abort: }static int nct7802_write_voltage (struct nct7802_data *data,int nr,int index, -unsigned int voltage) +unsigned long voltage) {int shift =8 -REG_VOLTAGE_LIMIT_MSB_SHIFT [index -1 ][nr];int err;
Signature · 7 lines
2.1.0 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 15 lines · Guenter Roeck
Writing a large value into a voltage limit attribute can result in an overflow due to an auto-conversion from unsigned long to unsigned int.
Cc Constantine Shulyupin <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/nct7802.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/nct7802.c +0
-0
drivers/hwmon/nct7802.c abort: · line 268
Quoted 8 lines
drivers/hwmon/nct7802.c +1
-1@@ -262,7 +262,7 @@ abort: }static int nct7802_write_voltage (struct nct7802_data *data,int nr,int index, -unsigned int voltage) +unsigned long voltage) {int shift =8 -REG_VOLTAGE_LIMIT_MSB_SHIFT [index -1 ][nr];int err;
Good catch.
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerHi Jean,
Quoted 27 lines · Jean Delvare
Quoted 15 lines · Guenter Roeck
Writing a large value into a voltage limit attribute can result in an overflow due to an auto-conversion from unsigned long to unsigned int.
Cc Constantine Shulyupin <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/hwmon/nct7802.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwmon/nct7802.c +0
-0drivers/hwmon/nct7802.c abort: · line 268
Quoted 8 lines
drivers/hwmon/nct7802.c +1
-1@@ -262,7 +262,7 @@ abort: }static int nct7802_write_voltage (struct nct7802_data *data,int nr,int index, -unsigned int voltage) +unsigned long voltage) {int shift =8 -REG_VOLTAGE_LIMIT_MSB_SHIFT [index -1 ][nr];int err;Good catch.
Quoted 2 lines
Reviewed-by Jean Delvare <[email protected]>
Thanks!
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors