Re: [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat,  4 Jul 2015 13:26:18 -0700, Guenter Roeck wrote:
> 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 <const@xxxxxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---
>  drivers/hwmon/nct7802.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
> index 658bc91033a2..457b0f2678a4 100644
> --- a/drivers/hwmon/nct7802.c
> +++ b/drivers/hwmon/nct7802.c
> @@ -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.

Reviewed-by: Jean Delvare <jdelvare@xxxxxxx>

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux