mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-26 10:53:25 +00:00
Fix panic in Cursor::new by invalid Vaddr range
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
8bfbdf6642
commit
f01772ca85
@ -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<M, E, C>, va: &Range<Vaddr>) -> Result<Self, PageTableError> {
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user