aboutsummaryrefslogtreecommitdiff
path: root/drivers/cdx/controller/mcdi_functions.c
diff options
context:
space:
mode:
authorNikita Zhandarovich <[email protected]>2023-05-10 07:35:37 -0700
committerGuenter Roeck <[email protected]>2023-05-19 05:59:37 -0700
commit0babf89c9cca7e074d6e59893e462e4886f481cc (patch)
treeddeb47377a07238929c6bc7144ffe4a780312ad1 /drivers/cdx/controller/mcdi_functions.c
parentf1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 (diff)
hwmon: (f71882fg) prevent possible division by zero
In the unlikely event that something goes wrong with the device and its registers, the fan_from_reg() function may return 0. This value will cause a division-by-zero error in the show_pwm() function. To prevent this, test the value of fan_from_reg(data->fan_full_speed[nr]) against 0 before performing the division. If the division-by-zero error is avoided, assign 0 to the val variable. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Fixes: df9ec2dae094 ("hwmon: (f71882fg) Reorder symbols to get rid of a few forward declarations") Signed-off-by: Nikita Zhandarovich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
Diffstat (limited to 'drivers/cdx/controller/mcdi_functions.c')
0 files changed, 0 insertions, 0 deletions