linux-sg2042/drivers/hwmon/occ
Lei YU 211186cae1 hwmon: (occ) Fix division by zero issue
The code in occ_get_powr_avg() invokes div64_u64() without checking the
divisor. In case the divisor is zero, kernel gets an "Division by zero
in kernel" error.

Check the divisor and make it return 0 if the divisor is 0.

Fixes: c10e753d43 ("hwmon (occ): Add sensor types and versions")
Signed-off-by: Lei YU <mine260309@gmail.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1562813088-23708-1-git-send-email-mine260309@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-07-21 19:18:45 -07:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
common.c hwmon: (occ) Fix division by zero issue 2019-07-21 19:18:45 -07:00
common.h OCC: FSI and hwmon: Add sequence numbering 2019-07-03 10:41:22 +09:30
p8_i2c.c hwmon: (occ) Fix license headers 2019-02-18 14:23:29 -08:00
p9_sbe.c hwmon: (occ) Fix license headers 2019-02-18 14:23:29 -08:00
sysfs.c hwmon: (occ) Prevent sysfs error attribute from returning error 2019-04-16 15:13:54 -07:00