diff --git a/ostd/src/mm/page_table/cursor.rs b/ostd/src/mm/page_table/cursor.rs index 75b1bdb9d..ee0d3d927 100644 --- a/ostd/src/mm/page_table/cursor.rs +++ b/ostd/src/mm/page_table/cursor.rs @@ -141,7 +141,7 @@ where /// Note that this function does not ensure exclusive access to the claimed /// virtual address range. The accesses using this cursor may block or fail. pub fn new(pt: &'a PageTable, va: &Range) -> Result { - if !M::covers(va) { + if !M::covers(va) || va.is_empty() { return Err(PageTableError::InvalidVaddrRange(va.start, va.end)); } if va.start % C::BASE_PAGE_SIZE != 0 || va.end % C::BASE_PAGE_SIZE != 0 {