From 4499b0418c1b65ecedff88604eb8f3760de3a8c0 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 2 Jul 2021 08:38:21 +0300 Subject: [PATCH] Kernel/TypedMapping: Round up length with offset_in_page Fixes #6948. --- Kernel/VM/TypedMapping.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/VM/TypedMapping.h b/Kernel/VM/TypedMapping.h index 61ca1fb6ac1..b9cc3ac36c5 100644 --- a/Kernel/VM/TypedMapping.h +++ b/Kernel/VM/TypedMapping.h @@ -27,7 +27,8 @@ template static TypedMapping map_typed(PhysicalAddress paddr, size_t length, Region::Access access = Region::Access::Read) { TypedMapping table; - table.region = MM.allocate_kernel_region(paddr.page_base(), page_round_up(length), {}, access); + size_t mapping_length = page_round_up(paddr.offset_in_page() + length); + table.region = MM.allocate_kernel_region(paddr.page_base(), mapping_length, {}, access); table.offset = paddr.offset_in_page(); return table; }