alistair23-linux/drivers/thermal/qcom
Colin Ian King f0a353b4d1 drivers: thermal: tsens: fix potential integer overflow on multiply
Currently a multiply operation is being performed on two int values
and the result is being assigned to a u64, presumably because the
end result is expected to be probably larger than an int. However,
because the multiply is an int multiply one can get overflow. Avoid
the overflow by casting degc to a u64 to force a u64 multiply.

Also use div_u64 for the divide as suggested by Daniel Lezcano.

Addresses-Coverity: ("Unintentional integer overflow")
Fixes: fbfe1a042cfd ("drivers: thermal: tsens: Add interrupt support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Link: https://lore.kernel.org/r/20191101100035.25502-1-colin.king@canonical.com
2019-11-07 07:00:26 +01: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
qcom-spmi-temp-alarm.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
tsens-8960.c drivers: thermal: tsens: Get rid of id field in tsens_sensor 2019-11-07 07:00:26 +01:00
tsens-common.c drivers: thermal: tsens: fix potential integer overflow on multiply 2019-11-07 07:00:26 +01:00
tsens-v0_1.c drivers: thermal: tsens: Add interrupt support 2019-11-07 07:00:26 +01:00
tsens-v1.c thermal: qcom: tsens-v1: Fix kfree of a non-pointer value 2019-11-07 07:00:26 +01:00
tsens-v2.c drivers: thermal: tsens: Add interrupt support 2019-11-07 07:00:26 +01:00
tsens.c thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976 2019-11-07 07:00:26 +01:00
tsens.h thermal: qcom: tsens-v1: Add support for MSM8956 and MSM8976 2019-11-07 07:00:26 +01:00