diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.h b/compiler-rt/lib/hwasan/hwasan_allocator.h --- a/compiler-rt/lib/hwasan/hwasan_allocator.h +++ b/compiler-rt/lib/hwasan/hwasan_allocator.h @@ -34,10 +34,10 @@ u32 requested_size_low; u32 requested_size_high; u32 alloc_context_id; - u64 get_requested_size() { + u64 GetRequestedSize() { return (static_cast(requested_size_high) << 32) + requested_size_low; } - void set_requested_size(u64 size) { + void SetRequestedSize(u64 size) { requested_size_low = size & ((1ul << 32) - 1); requested_size_high = size >> 32; } 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 @@ -43,7 +43,7 @@ bool HwasanChunkView::IsAllocated() const { return metadata_ && metadata_->alloc_context_id && - metadata_->get_requested_size(); + metadata_->GetRequestedSize(); } uptr HwasanChunkView::Beg() const { @@ -53,7 +53,7 @@ return Beg() + UsedSize(); } uptr HwasanChunkView::UsedSize() const { - return metadata_->get_requested_size(); + return metadata_->GetRequestedSize(); } u32 HwasanChunkView::GetAllocStackId() const { return metadata_->alloc_context_id; @@ -148,7 +148,7 @@ } Metadata *meta = reinterpret_cast(allocator.GetMetaData(allocated)); - meta->set_requested_size(orig_size); + meta->SetRequestedSize(orig_size); meta->alloc_context_id = StackDepotPut(*stack); if (zeroise) { internal_memset(allocated, 0, size); @@ -234,7 +234,7 @@ ReportInvalidFree(stack, reinterpret_cast(tagged_ptr)); return; } - uptr orig_size = meta->get_requested_size(); + uptr orig_size = meta->GetRequestedSize(); u32 free_context_id = StackDepotPut(*stack); u32 alloc_context_id = meta->alloc_context_id; @@ -255,7 +255,7 @@ orig_size, tail_magic); } - meta->set_requested_size(0); + meta->SetRequestedSize(0); meta->alloc_context_id = 0; // This memory will not be reused by anyone else, so we are free to keep it // poisoned. @@ -312,7 +312,7 @@ reinterpret_cast(allocator.GetMetaData(untagged_ptr_old)); internal_memcpy( UntagPtr(tagged_ptr_new), untagged_ptr_old, - Min(new_size, static_cast(meta->get_requested_size()))); + Min(new_size, static_cast(meta->GetRequestedSize()))); HwasanDeallocate(stack, tagged_ptr_old); } return tagged_ptr_new; @@ -344,7 +344,7 @@ const void *beg = allocator.GetBlockBegin(untagged_ptr); Metadata *b = (Metadata *)allocator.GetMetaData(untagged_ptr); if (beg != untagged_ptr) return 0; - return b->get_requested_size(); + return b->GetRequestedSize(); } void *hwasan_malloc(uptr size, StackTrace *stack) {