Fix reachable unwrap panic in check_sem()

This commit is contained in:
Yuke Peng
2024-08-23 17:15:18 +08:00
committed by Tate, Hongliang Tian
parent a039b58f8b
commit 42f70fd779

View File

@ -16,6 +16,9 @@ pub fn sys_semget(key: i32, nsems: i32, semflags: i32, ctx: &Context) -> Result<
if nsems < 0 || nsems as usize > SEMMSL {
return_errno!(Errno::EINVAL);
}
if key < 0 {
return_errno!(Errno::EINVAL);
}
let flags = IpcFlags::from_bits_truncate(semflags as u32);
let mode: u16 = (semflags as u32 & 0x1FF) as u16;