From 14f0c9317546e69e289efc6e24217ce20d550a5a Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 20 Sep 2023 22:41:48 +0200 Subject: [PATCH] kernel: Allow mapping the framebuffer even if its size is not page-aligned --- kernel/src/fs/devices/FramebufferDevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/src/fs/devices/FramebufferDevice.cpp b/kernel/src/fs/devices/FramebufferDevice.cpp index 39f19f44..7617b914 100644 --- a/kernel/src/fs/devices/FramebufferDevice.cpp +++ b/kernel/src/fs/devices/FramebufferDevice.cpp @@ -4,6 +4,7 @@ #include "video/Framebuffer.h" #include #include +#include Result FramebufferDevice::create() { @@ -27,7 +28,7 @@ Result FramebufferDevice::write(const u8* buf, usize offset, usize length Result FramebufferDevice::query_shared_memory(off_t offset, usize count) { - if (offset + (count * ARCH_PAGE_SIZE) > Framebuffer::size()) return err(EINVAL); + if (offset + (count * ARCH_PAGE_SIZE) > align_up((u64)Framebuffer::size())) return err(EINVAL); if (!m_shmid.has_value()) {