Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a5ca7665 authored by Peter Collingbourne's avatar Peter Collingbourne
Browse files

Avoid integer underflow involving maxFreqCount.

If a device does not have any policy directories under
/sys/devices/system/cpu/cpufreq this would previously lead to the
cputimeinstate subsystem being initialized with an empty set of policy
frequencies. This would lead to integer underflows in various loops
that enumerate the frequencies when subtracting 1 from a maxFreqCount
variable calculated as 0, resulting in us spending a significant amount
of time in these loops, likely leading to an ANR in system_server
since at least the loop in clearUidTimes is executed while holding the
BatteryStatsImpl lock. Fix the problem by skipping the initialization
of cputimeinstate if there are no policy directories.

Bug: 142352330
Bug: 178231152
Change-Id: I2ec1e8de0fe2a40ed100c8f14e6ca3f6d6285b82
parent 7c9b62c5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment