summaryrefslogtreecommitdiff
path: root/cmds/incident_helper/src
diff options
context:
space:
mode:
authorKenneth Magic <kmagic@google.com>2018-07-11 13:18:03 -0700
committerKenneth Magic <kmagic@google.com>2018-07-31 18:35:19 +0000
commit3abb43991685d0ba40e70dd5f81abe044f65b891 (patch)
tree5459bb3eb44b159e8bc2210b8212218db658a1d4 /cmds/incident_helper/src
parent209d21be019e1bc38e61eba48120fcac2657faf6 (diff)
Update PageTypeInfoParser to be less restrictive.
The page block order is an independent variable from the free page order table in the kernel, so the parser should not error out if they do not match. Bug: 110559361 Test: incident_helper_test Change-Id: I08ad9c8f9b29cc15b80a89929f3a1fb6886852e6
Diffstat (limited to 'cmds/incident_helper/src')
-rw-r--r--cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
index 0615c74b8d64..2a89c920c119 100644
--- a/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
+++ b/cmds/incident_helper/src/parsers/PageTypeInfoParser.cpp
@@ -75,18 +75,13 @@ PageTypeInfoParser::Parse(const int in, const int out) const
} else return BAD_VALUE;
// expect part 2 starts with "type"
if (stripPrefix(&record[2], "type")) {
- // expect the rest of part 2 has number of (pageBlockOrder + 2) parts
// An example looks like:
// header line: type 0 1 2 3 4 5 6 7 8 9 10
// record line: Unmovable 426 279 226 1 1 1 0 0 2 2 0
- // The pageBlockOrder = 10 and it's zero-indexed. so total parts
- // are 10 + 1(zero-indexed) + 1(the type part) = 12.
record_t pageCounts = parseRecord(record[2]);
- int pageCountsSize = pageBlockOrder + 2;
- if ((int)pageCounts.size() != pageCountsSize) return BAD_VALUE;
proto.write(PageTypeInfoProto::MigrateType::TYPE, pageCounts[0]);
- for (auto i=1; i<pageCountsSize; i++) {
+ for (size_t i=1; i<pageCounts.size(); i++) {
proto.write(PageTypeInfoProto::MigrateType::FREE_PAGES_COUNT, toInt(pageCounts[i]));
}
} else return BAD_VALUE;
@@ -125,4 +120,4 @@ PageTypeInfoParser::Parse(const int in, const int out) const
fprintf(stderr, "[%s]Proto size: %zu bytes\n", this->name.string(), proto.size());
return NO_ERROR;
-} \ No newline at end of file
+}