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,19 +100,21 @@ bool CpupmStateResidencyDataProvider::getStateResidencies(
|
|||||||
stateId = temp;
|
stateId = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateId >= 0) {
|
if (stateId < 0) continue;
|
||||||
entityIndex = matchEntity(line);
|
|
||||||
it = residencies->find(mConfig.entities[entityIndex].first);
|
|
||||||
|
|
||||||
if (it != residencies->end()) {
|
entityIndex = matchEntity(line);
|
||||||
if (parseState(line, &duration, &count)) {
|
|
||||||
it->second[stateId].totalTimeInStateMs = duration / US_TO_MS;
|
if (entityIndex < 0) continue;
|
||||||
it->second[stateId].totalStateEntryCount = count;
|
|
||||||
} else {
|
it = residencies->find(mConfig.entities[entityIndex].first);
|
||||||
LOG(ERROR) << "Failed to parse duration and count from [" << std::string(line)
|
if (it != residencies->end()) {
|
||||||
<< "]";
|
if (parseState(line, &duration, &count)) {
|
||||||
return false;
|
it->second[stateId].totalTimeInStateMs = duration / US_TO_MS;
|
||||||
}
|
it->second[stateId].totalStateEntryCount = count;
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Failed to parse duration and count from [" << std::string(line)
|
||||||
|
<< "]";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user