[compiler-rt] 6584758 - [NFC][Asan] Early return from GetBlockBegin
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 15:31:49 PDT 2020
Author: Vitaly Buka
Date: 2020-09-11T15:31:38-07:00
New Revision: 658475897b14781070549f72483fd283e3fe50aa
URL: https://github.com/llvm/llvm-project/commit/658475897b14781070549f72483fd283e3fe50aa
DIFF: https://github.com/llvm/llvm-project/commit/658475897b14781070549f72483fd283e3fe50aa.diff
LOG: [NFC][Asan] Early return from GetBlockBegin
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 774c09e42495..0a18b0c58ef7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -186,13 +186,13 @@ class SizeClassAllocator64 {
void *GetBlockBegin(const void *p) {
uptr class_id = GetSizeClass(p);
+ if (class_id >= kNumClasses) return nullptr;
uptr size = ClassIdToSize(class_id);
if (!size) return nullptr;
uptr chunk_idx = GetChunkIdx((uptr)p, size);
uptr reg_beg = GetRegionBegin(p);
uptr beg = chunk_idx * size;
uptr next_beg = beg + size;
- if (class_id >= kNumClasses) return nullptr;
const RegionInfo *region = AddressSpaceView::Load(GetRegionInfo(class_id));
if (region->mapped_user >= next_beg)
return reinterpret_cast<void*>(reg_beg + beg);
More information about the llvm-commits
mailing list