]> git.baikalelectronics.ru Git - kernel.git/commit
interconnect: qcom: msm8974: Prevent integer overflow in rate
authorGeorgi Djakov <georgi.djakov@linaro.org>
Fri, 6 Nov 2020 14:48:47 +0000 (16:48 +0200)
committerGeorgi Djakov <georgi.djakov@linaro.org>
Tue, 17 Nov 2020 22:18:05 +0000 (00:18 +0200)
commit7179eba99ad3d6ccafabbe494d5eb0dd887dd104
tree6abb59915407fd210af88aa8a4e6bcd57561ada3
parentcfc45683e0b3f77d850d7167351994c36f3fdee2
interconnect: qcom: msm8974: Prevent integer overflow in rate

When sync_state support got introduced recently, by default we try to
set the NoCs to run initially at maximum rate. But as these values are
aggregated, we may end with a really big clock rate value, which is
then converted from "u64" to "long" during the clock rate rounding.
But on 32bit platforms this may result an overflow. Fix it by making
sure that the rate is within range.

Reported-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Brian Masney <masneyb@onstation.org>
Link: https://lore.kernel.org/r/20201106144847.7726-1-georgi.djakov@linaro.org
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
drivers/interconnect/qcom/msm8974.c