[NFC][Asan] Early return from GetBlockBegin

This commit is contained in:
Vitaly Buka 2020-09-11 13:45:07 -07:00
parent 45d0343900
commit 658475897b
1 changed files with 1 additions and 1 deletions

View File

@ -186,13 +186,13 @@ class SizeClassAllocator64 {
void *GetBlockBegin(const void *p) { void *GetBlockBegin(const void *p) {
uptr class_id = GetSizeClass(p); uptr class_id = GetSizeClass(p);
if (class_id >= kNumClasses) return nullptr;
uptr size = ClassIdToSize(class_id); uptr size = ClassIdToSize(class_id);
if (!size) return nullptr; if (!size) return nullptr;
uptr chunk_idx = GetChunkIdx((uptr)p, size); uptr chunk_idx = GetChunkIdx((uptr)p, size);
uptr reg_beg = GetRegionBegin(p); uptr reg_beg = GetRegionBegin(p);
uptr beg = chunk_idx * size; uptr beg = chunk_idx * size;
uptr next_beg = beg + size; uptr next_beg = beg + size;
if (class_id >= kNumClasses) return nullptr;
const RegionInfo *region = AddressSpaceView::Load(GetRegionInfo(class_id)); const RegionInfo *region = AddressSpaceView::Load(GetRegionInfo(class_id));
if (region->mapped_user >= next_beg) if (region->mapped_user >= next_beg)
return reinterpret_cast<void*>(reg_beg + beg); return reinterpret_cast<void*>(reg_beg + beg);