summaryrefslogtreecommitdiff
path: root/Kernel/VM/InodeVMObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-14 09:57:19 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-14 10:01:50 +0100
commit09b1b09c1923c5e82c5500a06c501088ab5ac4ce (patch)
treef57307d460c8856604dfa21f3ab27b7a449cd4bc /Kernel/VM/InodeVMObject.cpp
parent198d64180886e6fad2997513c4c8f68b1338f4e4 (diff)
downloadserenity-09b1b09c1923c5e82c5500a06c501088ab5ac4ce.zip
Kernel: Assert if rounding-up-to-page-size would wrap around to 0
If we try to align a number above 0xfffff000 to the next multiple of the page size (4 KiB), it would wrap around to 0. This is most likely never what we want, so let's assert if that happens.
Diffstat (limited to 'Kernel/VM/InodeVMObject.cpp')
-rw-r--r--Kernel/VM/InodeVMObject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp
index 7676fcad08..4f8799142e 100644
--- a/Kernel/VM/InodeVMObject.cpp
+++ b/Kernel/VM/InodeVMObject.cpp
@@ -77,7 +77,7 @@ void InodeVMObject::inode_size_changed(Badge<Inode>, size_t old_size, size_t new
InterruptDisabler disabler;
- auto new_page_count = PAGE_ROUND_UP(new_size) / PAGE_SIZE;
+ auto new_page_count = page_round_up(new_size) / PAGE_SIZE;
m_physical_pages.resize(new_page_count);
m_dirty_pages.grow(new_page_count, false);