Set overflow boundary to isize::MAX for memory related syscalls

This commit is contained in:
Marsman1996
2024-08-29 22:26:36 +08:00
committed by Tate, Hongliang Tian
parent 9589b332aa
commit 745ac6d982
3 changed files with 3 additions and 3 deletions

View File

@ -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 > usize::MAX - PAGE_SIZE + 1 {
if len > isize::MAX as usize {
return_errno_with_message!(Errno::EINVAL, "len align overflow");
}
if len == 0 {