Commit 8abe853d authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Commit Bot

Clean up overflow check at PartitionRoot::AlignedAllocFlags.

Change-Id: I2b048b5daad0454609026ccea1497daa19a056bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444632Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Reviewed-by: default avatarTakashi Sakamoto <tasak@google.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#814165}
parent e0ba014b
......@@ -1111,19 +1111,17 @@ ALWAYS_INLINE void* PartitionRoot<thread_safe>::AlignedAllocFlags(
<< (sizeof(size_t) * 8 - base::bits::CountLeadingZeroBits(size - 1));
}
// TODO(tasak): Clean up the following condition and PA_CHECK(requested_size
// >= size).
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
if (size > MaxDirectMapped()) {
// Overflow check. requested_size must be larger or equal to size.
if (requested_size < size) {
if (flags & PartitionAllocReturnNull)
return nullptr;
// OutOfMemoryDeathTest.AlignedAlloc requires base::OnNoMemoryInternal
// (invoked by PartitionExcessiveAllocationSize).
internal::PartitionExcessiveAllocationSize(size);
IMMEDIATE_CRASH(); // Not required, kept as documentation.
// internal::PartitionExcessiveAllocationSize(size) causes OOM_CRASH.
NOTREACHED();
}
#endif
PA_CHECK(requested_size >= size); // Overflow check.
bool no_hooks = flags & PartitionAllocNoHooks;
void* ptr = no_hooks ? AllocFlagsNoHooks(0, requested_size)
: Alloc(requested_size, "");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment