Skip to content

Commit b977ec6

Browse files
authored
[scudo] Fix the loading of a signed value to an unsigned storage (llvm#111039)
1 parent 8ee7d91 commit b977ec6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler-rt/lib/scudo/standalone/primary64.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,12 +1403,11 @@ template <typename Config> class SizeClassAllocator64 {
14031403
if (RegionPushedBytesDelta < Region->ReleaseInfo.TryReleaseThreshold / 2)
14041404
return false;
14051405

1406-
const u64 IntervalNs =
1407-
static_cast<u64>(atomic_load_relaxed(&ReleaseToOsIntervalMs)) *
1408-
1000000;
1409-
if (IntervalNs < 0)
1406+
const s64 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs);
1407+
if (IntervalMs < 0)
14101408
return false;
14111409

1410+
const u64 IntervalNs = static_cast<u64>(IntervalMs) * 1000000;
14121411
const u64 CurTimeNs = getMonotonicTimeFast();
14131412
const u64 DiffSinceLastReleaseNs =
14141413
CurTimeNs - Region->ReleaseInfo.LastReleaseAtNs;

0 commit comments

Comments
 (0)