diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp --- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp +++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp @@ -163,7 +163,7 @@ static void *HwasanAllocate(StackTrace *stack, uptr orig_size, uptr alignment, bool zeroise) { // Keep this consistent with LSAN and ASAN behavior. - if (orig_size == 0) + if (UNLIKELY(orig_size == 0)) orig_size = 1; if (orig_size > kMaxAllowedMallocSize) { if (AllocatorMayReturnNull()) {