[compiler-rt] 9de144e - [HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated

Kirill Stoimenov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 07:52:21 PST 2023


Author: Kirill Stoimenov
Date: 2023-02-07T15:51:56Z
New Revision: 9de144eee5307363d7b4f1c8c1837c28223aead0

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

LOG: [HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_allocator.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 812ae78e71e4..b5bd6529dfb2 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -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 {


        


More information about the llvm-commits mailing list