All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
@ 2015-07-04 20:26 Guenter Roeck
  2015-07-06 11:46 ` Jean Delvare
  2015-07-06 12:51 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-07-04 20:26 UTC (permalink / raw)
  To: lm-sensors

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@MakeLinux.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 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;
-- 
2.1.0


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
  2015-07-04 20:26 [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits Guenter Roeck
@ 2015-07-06 11:46 ` Jean Delvare
  2015-07-06 12:51 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2015-07-06 11:46 UTC (permalink / raw)
  To: lm-sensors

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@MakeLinux.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  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@suse.de>

-- 
Jean Delvare
SUSE L3 Support

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits
  2015-07-04 20:26 [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits Guenter Roeck
  2015-07-06 11:46 ` Jean Delvare
@ 2015-07-06 12:51 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-07-06 12:51 UTC (permalink / raw)
  To: lm-sensors

Hi Jean,

On 07/06/2015 04:46 AM, Jean Delvare wrote:
> 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@MakeLinux.com>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   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@suse.de>
>
Thanks!

Guenter


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-06 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-04 20:26 [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits Guenter Roeck
2015-07-06 11:46 ` Jean Delvare
2015-07-06 12:51 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.