We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c716be8 commit 3f3ef9fCopy full SHA for 3f3ef9f
kernel/src/filesystem/vfs/syscall/sys_pread64.rs
@@ -36,12 +36,7 @@ impl Syscall for SysPread64Handle {
36
let len = Self::len(args);
37
let offset = Self::offset(args);
38
39
- // 检查offset是否为负数
40
- if (offset as isize) < 0 {
41
- return Err(SystemError::EINVAL);
42
- }
43
-
44
- // 检查offset + len是否溢出
+ // 检查offset + len是否溢出 同时检查offset是否为负数
45
46
let end_pos = offset.checked_add(len).ok_or(SystemError::EINVAL)?;
47
if offset > i64::MAX as usize || end_pos > i64::MAX as usize {
0 commit comments