Skip to content

Commit 3f3ef9f

Browse files
删去冗余的负数判断
1 parent c716be8 commit 3f3ef9f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

kernel/src/filesystem/vfs/syscall/sys_pread64.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ impl Syscall for SysPread64Handle {
3636
let len = Self::len(args);
3737
let offset = Self::offset(args);
3838

39-
// 检查offset是否为负数
40-
if (offset as isize) < 0 {
41-
return Err(SystemError::EINVAL);
42-
}
43-
44-
// 检查offset + len是否溢出
39+
// 检查offset + len是否溢出 同时检查offset是否为负数
4540

4641
let end_pos = offset.checked_add(len).ok_or(SystemError::EINVAL)?;
4742
if offset > i64::MAX as usize || end_pos > i64::MAX as usize {

0 commit comments

Comments
 (0)