summaryrefslogtreecommitdiff
path: root/Kernel/KBufferBuilder.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/KBufferBuilder.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/KBufferBuilder.cpp')
-rw-r--r--Kernel/KBufferBuilder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/KBufferBuilder.cpp b/Kernel/KBufferBuilder.cpp
index 07f467fc3c..1c8a012dac 100644
--- a/Kernel/KBufferBuilder.cpp
+++ b/Kernel/KBufferBuilder.cpp
@@ -42,7 +42,7 @@ inline bool KBufferBuilder::check_expand(size_t size)
size_t new_buffer_size = m_size + size;
if (Checked<size_t>::addition_would_overflow(new_buffer_size, 1 * MiB))
return false;
- new_buffer_size = PAGE_ROUND_UP(new_buffer_size + 1 * MiB);
+ new_buffer_size = page_round_up(new_buffer_size + 1 * MiB);
return m_buffer->expand(new_buffer_size);
}