From e76cf536a477bf8f605c77c59aca2b4331b002e9 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. Change-Id: I46c5e00558b7dbd6abd50fae4727396079044df2 --- Utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utils.cpp b/Utils.cpp index e19c9df..51ef4c4 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -410,7 +410,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; }