[HWASAN] Add unlikely to if in HwasanAllocate.
authorKirill Stoimenov <kstoimenov@google.com>
Tue, 7 Feb 2023 00:39:17 +0000 (00:39 +0000)
committerKirill Stoimenov <kstoimenov@google.com>
Tue, 7 Feb 2023 00:39:17 +0000 (00:39 +0000)
compiler-rt/lib/hwasan/hwasan_allocator.cpp

index ec52741..812ae78 100644 (file)
@@ -165,7 +165,7 @@ static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment,
   // Keep this consistent with LSAN and ASAN behavior.
   if (UNLIKELY(orig_size == 0))
     orig_size = 1;
-  if (orig_size > kMaxAllowedMallocSize) {
+  if (UNLIKELY(orig_size > kMaxAllowedMallocSize)) {
     if (AllocatorMayReturnNull()) {
       Report("WARNING: HWAddressSanitizer failed to allocate 0x%zx bytes\n",
              orig_size);