[HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated
authorKirill Stoimenov <kstoimenov@google.com>
Tue, 7 Feb 2023 00:02:17 +0000 (00:02 +0000)
committerKirill Stoimenov <kstoimenov@google.com>
Tue, 7 Feb 2023 15:51:56 +0000 (15:51 +0000)
After D143438 there is no point in this check as the size will never 0. Also this keeps it consistent with ASAN where there is not size check in LsanMetadata::allocated.

Reviewed By: MaskRay, vitalybuka

Differential Revision: https://reviews.llvm.org/D143442

compiler-rt/lib/hwasan/hwasan_allocator.cpp

index 812ae78..b5bd652 100644 (file)
@@ -94,8 +94,7 @@ inline void Metadata::SetUnallocated() {
 }
 
 inline bool Metadata::IsAllocated() const {
-  return atomic_load(&chunk_state, memory_order_relaxed) == CHUNK_ALLOCATED &&
-         GetRequestedSize();
+  return atomic_load(&chunk_state, memory_order_relaxed) == CHUNK_ALLOCATED;
 }
 
 inline u64 Metadata::GetRequestedSize() const {