mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
UPSTREAM: PM: domains: fix integer overflow issues in genpd_parse_state()
Currently, while calculating residency and latency values, right operands may overflow if resulting values are big enough. To prevent this, albeit unlikely case, play it safe and convert right operands to left ones' type s64. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Bug: 296029082 Fixes:30f604283e("PM / Domains: Allow domain power states to be read from DT") Change-Id: Id0355d95ff18dc2273fca719aa64e2d32b1f9da5 Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commite5d1c87220) Signed-off-by: Daniel Mentz <danielmentz@google.com>
This commit is contained in:
committed by
Daniel Mentz
parent
e3e2ece8a0
commit
fd2e98c6f5
@@ -2923,10 +2923,10 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
|
|||||||
|
|
||||||
err = of_property_read_u32(state_node, "min-residency-us", &residency);
|
err = of_property_read_u32(state_node, "min-residency-us", &residency);
|
||||||
if (!err)
|
if (!err)
|
||||||
genpd_state->residency_ns = 1000 * residency;
|
genpd_state->residency_ns = 1000LL * residency;
|
||||||
|
|
||||||
genpd_state->power_on_latency_ns = 1000 * exit_latency;
|
genpd_state->power_on_latency_ns = 1000LL * exit_latency;
|
||||||
genpd_state->power_off_latency_ns = 1000 * entry_latency;
|
genpd_state->power_off_latency_ns = 1000LL * entry_latency;
|
||||||
genpd_state->fwnode = &state_node->fwnode;
|
genpd_state->fwnode = &state_node->fwnode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user