Kernel/TypedMapping: Round up length with offset_in_page

Fixes #6948.
This commit is contained in:
Liav A 2021-07-02 08:38:21 +03:00 committed by Andreas Kling
parent 3344f91fc4
commit 4499b0418c
Notes: sideshowbarker 2024-07-18 11:08:09 +09:00

View file

@ -27,7 +27,8 @@ template<typename T>
static TypedMapping<T> map_typed(PhysicalAddress paddr, size_t length, Region::Access access = Region::Access::Read)
{
TypedMapping<T> 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;
}