]> git.baikalelectronics.ru Git - kernel.git/commit
interconnect: qcom: rpm: Prevent integer overflow in rate
authorStephan Gerhold <stephan@gerhold.net>
Mon, 6 Dec 2021 11:45:42 +0000 (12:45 +0100)
committerGeorgi Djakov <djakov@kernel.org>
Mon, 6 Dec 2021 17:52:19 +0000 (19:52 +0200)
commit6cc68e6f8c8dff87f6a02cd2bd0ab0cee82464f6
tree331e678bc7e0c21862b565dcd3ed08541a352217
parentd3a30fb9b7f2be3a4bbbdd84bba293ad3a8e9181
interconnect: qcom: rpm: Prevent integer overflow in rate

Using icc-rpm on ARM32 currently results in clk_set_rate() errors during
boot, e.g. "bus clk_set_rate error: -22". This is very similar to commit
7179eba99ad3 ("interconnect: qcom: msm8974: Prevent integer overflow in rate")
where the u64 is converted to a signed long during clock rate rounding,
resulting in an overflow on 32-bit platforms.

Let's fix it similarly by making sure that the rate does not exceed
LONG_MAX. Such high clock rates will surely result in the maximum
frequency of the bus anyway.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20211206114542.45325-1-stephan@gerhold.net
Signed-off-by: Georgi Djakov <djakov@kernel.org>
drivers/interconnect/qcom/icc-rpm.c