snapshot_test: Fix overflow in statvfs arithmetics
Operations on (unsigned long) f_bsize and f_bfree are correctly handled on 64 bit architectures, but when switching to 32 bit, the multiplication between the two could result in an overflow, causing the test to crash. Fix by using a uint64_t operand, hinting the compiler to handle the whole multiplication with 64 bit operands. Bug: 154355449 Bug: 148889015 Test: vts_libsnapshot_test (32 bit) Signed-off-by: Alessio Balsini <balsini@google.com> Change-Id: Ief5c03ff7954c4a3e8597ef6e7df467f59428877 Merged-In: Ief5c03ff7954c4a3e8597ef6e7df467f59428877
This commit is contained in:
parent
eb3f92f1ba
commit
2612f9b116
|
@ -212,8 +212,8 @@ AssertionResult LowSpaceUserdata::ReadUserdataStats() {
|
|||
return AssertionFailure() << strerror(errno);
|
||||
}
|
||||
bsize_ = buf.f_bsize;
|
||||
free_space_ = buf.f_bsize * buf.f_bfree;
|
||||
available_space_ = buf.f_bsize * buf.f_bavail;
|
||||
free_space_ = bsize_ * buf.f_bfree;
|
||||
available_space_ = bsize_ * buf.f_bavail;
|
||||
return AssertionSuccess();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue