hwmon: (adm9240) Fix overflows seen when writing into limit attributes
authorGuenter Roeck <linux@roeck-us.net>
Sun, 20 Nov 2016 18:14:09 +0000 (10:14 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 9 Dec 2016 14:09:23 +0000 (06:09 -0800)
commit0fb620c4334eab14e85b7f66389e9061a225fb7e
tree4e7434d74b559ff6055fc1c0b1442d4d097137e3
parent1b109c49b72dc3cb8392bbc22bad662f71b8fd80
hwmon: (adm9240) Fix overflows seen when writing into limit attributes

Module test reports:

in0_min: Suspected overflow: [3320 vs. 0]
in0_max: Suspected overflow: [3320 vs. 0]
in4_min: Suspected overflow: [15938 vs. 0]
in4_max: Suspected overflow: [15938 vs. 0]
temp1_max: Suspected overflow: [127000 vs. 0]
temp1_max_hyst: Suspected overflow: [127000 vs. 0]
aout_output: Suspected overflow: [1250 vs. 0]

Code analysis reveals that the overflows are caused by conversions
from unsigned long to long to int, combined with multiplications on
passed values.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adm9240.c