Merge "vold: fix write kbytes handling" am: 13a57d2a26 am: 486c3507fb am: d4680bb584

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2507268

Change-Id: I97a52712004285b30340f428f280abe43a0c7a7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Daeho Jeong 2023-03-28 21:29:55 +00:00 committed by Automerger Merge Worker
commit bfb937b068

View file

@ -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;
}