Skip to content

Commit 31f1d04

Browse files
committed
properly jump the address gap in CleanUp
Starting with 0.15, the addition operator will no longer implicitly jump the gap in the address space. Instead, we can use Step::forward.
1 parent 4f95c56 commit 31f1d04

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/structures/paging/mapper/mapped_page_table.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,11 @@ impl<'a, P: PageTableFrameMapping> CleanUp for MappedPageTable<'a, P> {
646646
.skip(usize::from(start))
647647
{
648648
if let Ok(page_table) = page_table_walker.next_table_mut(entry) {
649-
let start = table_addr + (offset_per_entry * (i as u64));
649+
let start = VirtAddr::forward_checked_impl(
650+
table_addr,
651+
(offset_per_entry as usize) * i,
652+
)
653+
.unwrap();
650654
let end = start + (offset_per_entry - 1);
651655
let start = Page::<Size4KiB>::containing_address(start);
652656
let start = start.max(range.start);

src/structures/paging/mapper/recursive_page_table.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,11 @@ impl<'a> CleanUp for RecursivePageTable<'a> {
891891
})
892892
{
893893
if let Ok(frame) = entry.frame() {
894-
let start = table_addr + (offset_per_entry * (i as u64));
894+
let start = VirtAddr::forward_checked_impl(
895+
table_addr,
896+
(offset_per_entry as usize) * i,
897+
)
898+
.unwrap();
895899
let end = start + (offset_per_entry - 1);
896900
let start = Page::<Size4KiB>::containing_address(start);
897901
let start = start.max(range.start);

0 commit comments

Comments
 (0)