From: Jean Delvare Date: Mon, 06 Jul 2015 11:46:54 +0000 Subject: Re: [lm-sensors] [PATCH] hwmon: (nct7802) Fix integer overflow seen when writing voltage limits Message-Id: <20150706134654.3cb5d394@endymion.delvare> List-Id: References: <1436041578-14411-1-git-send-email-linux@roeck-us.net> In-Reply-To: <1436041578-14411-1-git-send-email-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lm-sensors@vger.kernel.org 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 > Signed-off-by: Guenter Roeck > --- > 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 -- Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list lm-sensors@lm-sensors.org http://lists.lm-sensors.org/mailman/listinfo/lm-sensors