Commit 3e56edb0 authored by Martin Blumenstingl's avatar Martin Blumenstingl Committed by Greg Kroah-Hartman
Browse files

clocksource/drivers/arm_global_timer: Guard against division by zero



[ Upstream commit e651f2fa ]

The result of the division of new_rate by gt_target_rate can be zero (if
new_rate is smaller than gt_target_rate). Using that result as divisor
without checking can result in a division by zero error. Guard against
this by checking for a zero value earlier.
While here, also change the psv variable to an unsigned long to make
sure we don't overflow the datatype as all other types involved are also
unsiged long.

Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20240225151336.2728533-3-martin.blumenstingl@googlemail.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e20977b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment