[compiler-rt] b977ec6 - [scudo] Fix the loading of a signed value to an unsigned storage (#111039)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 14:15:49 PDT 2024


Author: ChiaHungDuan
Date: 2024-10-03T14:15:46-07:00
New Revision: b977ec6c1fc37c5a4e787554d0f2ce0ef243daa8

URL: https://github.com/llvm/llvm-project/commit/b977ec6c1fc37c5a4e787554d0f2ce0ef243daa8
DIFF: https://github.com/llvm/llvm-project/commit/b977ec6c1fc37c5a4e787554d0f2ce0ef243daa8.diff

LOG: [scudo] Fix the loading of a signed value to an unsigned storage (#111039)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index c02058219b5e13..97188a5ac235cc 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1403,12 +1403,11 @@ template <typename Config> class SizeClassAllocator64 {
       if (RegionPushedBytesDelta < Region->ReleaseInfo.TryReleaseThreshold / 2)
         return false;
 
-      const u64 IntervalNs =
-          static_cast<u64>(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<u64>(IntervalMs) * 1000000;
       const u64 CurTimeNs = getMonotonicTimeFast();
       const u64 DiffSinceLastReleaseNs =
           CurTimeNs - Region->ReleaseInfo.LastReleaseAtNs;


        


More information about the llvm-commits mailing list