Kernel: Hoist VERIFY from a loop in RangeAllocator::allocate_specific()
This commit is contained in:
parent
7ff14fecba
commit
b0d9b88c49
Notes:
sideshowbarker
2024-07-18 08:59:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/b0d9b88c490
1 changed files with 3 additions and 2 deletions
|
@ -136,11 +136,12 @@ Optional<Range> RangeAllocator::allocate_specific(VirtualAddress base, size_t si
|
|||
VERIFY(base.is_page_aligned());
|
||||
VERIFY((size % PAGE_SIZE) == 0);
|
||||
|
||||
Range allocated_range(base, size);
|
||||
Range const allocated_range(base, size);
|
||||
VERIFY(m_total_range.contains(allocated_range));
|
||||
|
||||
ScopedSpinLock lock(m_lock);
|
||||
for (size_t i = 0; i < m_available_ranges.size(); ++i) {
|
||||
auto& available_range = m_available_ranges[i];
|
||||
VERIFY(m_total_range.contains(allocated_range));
|
||||
if (!available_range.contains(base, size))
|
||||
continue;
|
||||
if (available_range == allocated_range) {
|
||||
|
|
Loading…
Add table
Reference in a new issue