Re: [PATCH] hwmon: (lm78) Fix overflow problems seen when writing large limits

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

 



2014-07-30 11:52 GMT+08:00 Guenter Roeck <linux@xxxxxxxxxxxx>:
> On platforms with sizeof(int) < sizeof(long), writing a temperature
> limit larger than MAXINT will result in unpredictable limit values
> written to the chip. Avoid auto-conversion from long to int to fix
> the problem.
>
> Cc: Axel Lin <axel.lin@xxxxxxxxxx>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
The patch looks good to me, so
Reviewed-by: Axel Lin <axel.lin@xxxxxxxxxx>

BTW, seems other drivers have similar issue:
$ grep "TEMP_TO_REG(int" drivers/hwmon/*.c
drivers/hwmon/dme1737.c:static inline int TEMP_TO_REG(int val)
drivers/hwmon/lm77.c:static inline s16 LM77_TEMP_TO_REG(int temp)
drivers/hwmon/lm78.c:static inline s8 TEMP_TO_REG(int val)
drivers/hwmon/lm92.c:static inline s16 TEMP_TO_REG(int val)
drivers/hwmon/sis5595.c:static inline s8 TEMP_TO_REG(int val)
drivers/hwmon/smsc47m192.c:static inline s8 TEMP_TO_REG(int val)

Axel

_______________________________________________
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