summaryrefslogtreecommitdiff
path: root/fs/statfs.c
diff options
context:
space:
mode:
authorDien Pham <dien.pham.ry@renesas.com>2020-06-25 20:38:19 +0900
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-06-29 12:15:34 +0200
commit5f8f06425a0dcdad7bedbb77e67f5c65ab4dacfc (patch)
tree97e6f855be0429972cdb6fb4b994080717a6051e /fs/statfs.c
parent371a3bc79c11b707d7a1b7a2c938dc3cc042fffb (diff)
downloadlinux-5f8f06425a0dcdad7bedbb77e67f5c65ab4dacfc.tar.gz
linux-5f8f06425a0dcdad7bedbb77e67f5c65ab4dacfc.tar.bz2
linux-5f8f06425a0dcdad7bedbb77e67f5c65ab4dacfc.zip
thermal/drivers/rcar_gen3: Fix undefined temperature if negative
As description for DIV_ROUND_CLOSEST in file include/linux/kernel.h. "Result is undefined for negative divisors if the dividend variable type is unsigned and for negative dividends if the divisor variable type is unsigned." In current code, the FIXPT_DIV uses DIV_ROUND_CLOSEST but has not checked sign of divisor before using. It makes undefined temperature value in case the value is negative. This patch fixes to satisfy DIV_ROUND_CLOSEST description and fix bug too. Note that the variable name "reg" is not good because it should be the same type as rcar_gen3_thermal_read(). However, it's better to rename the "reg" in a further patch as cleanup. Signed-off-by: Van Do <van.do.xw@renesas.com> Signed-off-by: Dien Pham <dien.pham.ry@renesas.com> [shimoda: minor fixes, add Fixes tag] Fixes: 564e73d283af ("thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Niklas Soderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by: Niklas Soderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/1593085099-2057-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Diffstat (limited to 'fs/statfs.c')
0 files changed, 0 insertions, 0 deletions