Skip to content

Commit ce296f3

Browse files
committed
add warning to RecursivePageTable::new
1 parent 3de642b commit ce296f3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/structures/paging/mapper/recursive_page_table.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ impl<'a> RecursivePageTable<'a> {
4747
/// - The page table must be active, i.e. the CR3 register must contain its physical address.
4848
///
4949
/// Otherwise `Err(())` is returned.
50+
///
51+
/// ## Safety
52+
///
53+
/// Creating a recursive page table with recursive index 511 is unsound
54+
/// because calculating the end ptr of the structure causes an overflow.
5055
#[inline]
5156
pub fn new(table: &'a mut PageTable) -> Result<Self, InvalidPageTable> {
5257
let page = Page::containing_address(VirtAddr::new(table as *const _ as u64));

0 commit comments

Comments
 (0)