mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Fix integer overflow caused by page align
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
0a8ad6971a
commit
e184094648
@ -20,7 +20,7 @@ pub fn sys_madvise(
|
||||
if start % PAGE_SIZE != 0 {
|
||||
return_errno_with_message!(Errno::EINVAL, "the start address should be page aligned");
|
||||
}
|
||||
if len == 0 {
|
||||
if len == 0 || len > usize::MAX - PAGE_SIZE + 1 {
|
||||
return Ok(SyscallReturn::Return(0));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user