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;
|
||||
}
|
||||
|
||||
if (stateId >= 0) {
|
||||
entityIndex = matchEntity(line);
|
||||
it = residencies->find(mConfig.entities[entityIndex].first);
|
||||
if (stateId < 0) continue;
|
||||
|
||||
if (it != residencies->end()) {
|
||||
if (parseState(line, &duration, &count)) {
|
||||
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;
|
||||
}
|
||||
entityIndex = matchEntity(line);
|
||||
|
||||
if (entityIndex < 0) continue;
|
||||
|
||||
it = residencies->find(mConfig.entities[entityIndex].first);
|
||||
if (it != residencies->end()) {
|
||||
if (parseState(line, &duration, &count)) {
|
||||
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