Skip to content
Commit 5f674df0 authored by Lei YU's avatar Lei YU Committed by Greg Kroah-Hartman
Browse files

hwmon: (occ) Fix division by zero issue



[ Upstream commit 211186ca ]

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: c10e753d ("hwmon (occ): Add sensor types and versions")
Signed-off-by: default avatarLei YU <mine260309@gmail.com>
Reviewed-by: default avatarEddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1562813088-23708-1-git-send-email-mine260309@gmail.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b95697c8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment