From 27d07796b4a240eec14a010935b61afb463d67c8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 28 Jan 2021 14:40:14 +0100 Subject: [PATCH] Kernel: Add sanity check assertion in RangeAllocator::allocate_anywhere The requested alignment should always be a multiple of the page size. --- Kernel/VM/RangeAllocator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Kernel/VM/RangeAllocator.cpp b/Kernel/VM/RangeAllocator.cpp index c6292cc715..6db31078ae 100644 --- a/Kernel/VM/RangeAllocator.cpp +++ b/Kernel/VM/RangeAllocator.cpp @@ -112,6 +112,7 @@ Optional RangeAllocator::allocate_anywhere(size_t size, size_t alignment) return {}; ASSERT((size % PAGE_SIZE) == 0); + ASSERT((alignment % PAGE_SIZE) == 0); #ifdef VM_GUARD_PAGES // NOTE: We pad VM allocations with a guard page on each side.