Fix arithmetic overflow in ntc_thermistor driver

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJS/lvWAAoJEMsfJm/On5mBROYP/0vOFqenG87/e+tSv6TylaFs
 u72rl5mdtuA9XMje2je65DI8YFgtco5SSDDITsMT16NvLuB5nMLDT3LqOp2guCrF
 2VTbIWt+DZTU14w2qZdUrrxVHgVWc33W/cRrwbmq+mf04lDDwaShflPzq1nVbYAw
 UMNGbrytbNclYR0YBPT/LpeDSsoLTsvqbkMKPRKKyXSgZyKLKUwmWAR6hmJzfXJH
 4hs28zVOEpl295hI56qgdhHrVbGN3RtrwGAFeNYgKG3QVP6JOtNtof7/iA3on9SF
 WVNIoxb/9o+LlvFUcSswHaSGduQqxvkFcSOyajNzEaRDeKHSvC870lip1m1oha5D
 49UxZoRfeGx+VAQZ+dzvRfhqNzG52Q0RAy8Rucl/SSXyjDZKCGes9KeO0BFH0edm
 y72SxkJLiY2wRWrurTeFcGXVDHJFRWwN3Y0OXPIxaCZ63fMT1H2BZPcfsZwj145S
 3Pb5XpgBTrP16OMDtjDzObbZt0kf8Bh1AppKue1sqkn6DqYtuScmSLEB6nel1VUR
 bA4VO6nOmEaM5Em7bHm8HVzjMBHj+CnQ83J5ZyEZT58VPqAhC6NEVL3CBneFlfFS
 AJuCfbYY0WKaPCRaj7dJGncs5KIvIIw6ITMjODEJ87nviTqHYqV2dYOCW+mzHEVA
 HmMAK5dRne2Yy/xtteQj
 =QOnc
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
 "Fix arithmetic overflow in ntc_thermistor driver"

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (ntc_thermistor) Avoid math overflow
This commit is contained in:
Linus Torvalds 2014-02-14 10:33:13 -08:00
commit 8564358667

View File

@ -145,7 +145,7 @@ struct ntc_data {
static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
{
struct iio_channel *channel = pdata->chan;
unsigned int result;
s64 result;
int val, ret;
ret = iio_read_channel_raw(channel, &val);
@ -155,10 +155,10 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
}
/* unit: mV */
result = pdata->pullup_uv * val;
result = pdata->pullup_uv * (s64) val;
result >>= 12;
return result;
return (int)result;
}
static const struct of_device_id ntc_match[] = {