From 2403b4d0561c756ed5102aaf6048a80c9993f6f8 Mon Sep 17 00:00:00 2001 From: Oleksiy Avramchenko Date: Thu, 1 Oct 2015 12:44:46 +0200 Subject: [PATCH] Promote free bytes calculation to 64 bits The expression otherwise overflows for large devices. It's fsblkcnt_t -> unsigned long, which is 32 bit on ARMv7. Bug: 25162062 Change-Id: I46c5e00558b7dbd6abd50fae4727396079044df2 --- Utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utils.cpp b/Utils.cpp index f352e84..279c990 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -432,7 +432,7 @@ status_t NormalizeHex(const std::string& in, std::string& out) { uint64_t GetFreeBytes(const std::string& path) { struct statvfs sb; if (statvfs(path.c_str(), &sb) == 0) { - return sb.f_bfree * sb.f_bsize; + return (uint64_t)sb.f_bfree * sb.f_bsize; } else { return -1; }