diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-15 00:06:04 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-15 01:48:09 +0200 |
commit | b0d9b88c490298f85e7588a84b5ec4c8942fab65 (patch) | |
tree | b5c56916e3a9a190e994823a52b16bea2965ee5f /Kernel | |
parent | 7ff14fecba4051f8d3d67f801b01aaee648701b0 (diff) | |
download | serenity-b0d9b88c490298f85e7588a84b5ec4c8942fab65.zip |
Kernel: Hoist VERIFY from a loop in RangeAllocator::allocate_specific()
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/VM/RangeAllocator.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index fc136f12ac..411597ce24 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -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) { |