diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h index c02058219b5e1..97188a5ac235c 100644 --- a/compiler-rt/lib/scudo/standalone/primary64.h +++ b/compiler-rt/lib/scudo/standalone/primary64.h @@ -1403,12 +1403,11 @@ template class SizeClassAllocator64 { if (RegionPushedBytesDelta < Region->ReleaseInfo.TryReleaseThreshold / 2) return false; - const u64 IntervalNs = - static_cast(atomic_load_relaxed(&ReleaseToOsIntervalMs)) * - 1000000; - if (IntervalNs < 0) + const s64 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs); + if (IntervalMs < 0) return false; + const u64 IntervalNs = static_cast(IntervalMs) * 1000000; const u64 CurTimeNs = getMonotonicTimeFast(); const u64 DiffSinceLastReleaseNs = CurTimeNs - Region->ReleaseInfo.LastReleaseAtNs;