powerstats: fix buffer underflow issue in CPUPM data provider
Bug: 267827563 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I569a20f250c7ca3586f71084918022f04d6693d4 Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
d865bd3bf9
commit
d094ba620f
@ -100,10 +100,13 @@ bool CpupmStateResidencyDataProvider::getStateResidencies(
|
|||||||
stateId = temp;
|
stateId = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateId >= 0) {
|
if (stateId < 0) continue;
|
||||||
entityIndex = matchEntity(line);
|
|
||||||
it = residencies->find(mConfig.entities[entityIndex].first);
|
|
||||||
|
|
||||||
|
entityIndex = matchEntity(line);
|
||||||
|
|
||||||
|
if (entityIndex < 0) continue;
|
||||||
|
|
||||||
|
it = residencies->find(mConfig.entities[entityIndex].first);
|
||||||
if (it != residencies->end()) {
|
if (it != residencies->end()) {
|
||||||
if (parseState(line, &duration, &count)) {
|
if (parseState(line, &duration, &count)) {
|
||||||
it->second[stateId].totalTimeInStateMs = duration / US_TO_MS;
|
it->second[stateId].totalTimeInStateMs = duration / US_TO_MS;
|
||||||
@ -115,7 +118,6 @@ bool CpupmStateResidencyDataProvider::getStateResidencies(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user