Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67e3bbc7 authored by Yi-Yo Chiang's avatar Yi-Yo Chiang Committed by Yo Chiang
Browse files

Explicitly cast to 64bit integer when calculating filesystem size

Else the result may overflow on platforms that have 32bit long.

Bug: 165925766
Test: Presubmit
Change-Id: I3018f0bd9846651848bd9b3645f2eeaa5b61c646
parent ec1b09fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ bool fs_mgr_filesystem_has_space(const std::string& mount_point) {
    static constexpr unsigned long kSizeThreshold = 8 * 1024 * 1024;  // 8MB

    return (vst.f_bfree >= (vst.f_blocks * kPercentThreshold / 100)) &&
           (vst.f_bfree * vst.f_bsize) >= kSizeThreshold;
           (static_cast<uint64_t>(vst.f_bfree) * vst.f_frsize) >= kSizeThreshold;
}

const auto kPhysicalDevice = "/dev/block/by-name/"s;