diff --git a/src/syscalls/mod.rs b/src/syscalls/mod.rs index 4902df8d50..9bea17b083 100644 --- a/src/syscalls/mod.rs +++ b/src/syscalls/mod.rs @@ -418,7 +418,7 @@ pub unsafe extern "C" fn sys_read(fd: FileDescriptor, buf: *mut u8, len: usize) #[hermit_macro::system] pub unsafe extern "C" fn sys_readv(fd: i32, iov: *const iovec, iovcnt: i32) -> isize { - if iovcnt < 0 || iovcnt > IOV_MAX { + if !(0..=IOV_MAX).contains(&iovcnt) { return (-crate::errno::EINVAL).try_into().unwrap(); } @@ -462,7 +462,7 @@ pub unsafe extern "C" fn sys_write(fd: FileDescriptor, buf: *const u8, len: usiz #[hermit_macro::system] pub unsafe extern "C" fn sys_writev(fd: FileDescriptor, iov: *const iovec, iovcnt: i32) -> isize { - if iovcnt < 0 || iovcnt > IOV_MAX { + if !(0..=IOV_MAX).contains(&iovcnt) { return (-crate::errno::EINVAL).try_into().unwrap(); }