Skip to content

Commit

Permalink
Merge "vold: fix write kbytes handling"
Browse files Browse the repository at this point in the history
  • Loading branch information
Daeho Jeong authored and Gerrit Code Review committed Mar 28, 2023
2 parents c1572fe + dd08c52 commit 13a57d2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion IdleMaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,12 @@ static int32_t getLifeTimeWrite() {
return -1;
}

long long writeBytes = std::stoll(writeKbytesStr);
unsigned long long writeBytes = std::strtoull(writeKbytesStr.c_str(), NULL, 0);
/* Careful: values > LLONG_MAX can appear in the file due to a kernel bug. */
if (writeBytes / KBYTES_IN_SEGMENT > INT32_MAX) {
LOG(WARNING) << "Bad lifetime_write_kbytes: " << writeKbytesStr;
return -1;
}
return writeBytes / KBYTES_IN_SEGMENT;
}

Expand Down

0 comments on commit 13a57d2

Please sign in to comment.