From e403fd8705dc1c3e38ed50fa9b5ff946368421e6 Mon Sep 17 00:00:00 2001 From: Kirill Stoimenov Date: Tue, 7 Feb 2023 00:39:17 +0000 Subject: [PATCH] [HWASAN] Add unlikely to if in HwasanAllocate. --- compiler-rt/lib/hwasan/hwasan_allocator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp index ec52741..812ae78 100644 --- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp +++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp @@ -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); -- 2.7.4