diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 7962922612428d957834d566b524bd6cfa4123b8..2f863d9f263fda61cc6abbbff11abe3af505eb3c 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -342,7 +342,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> { let mut active_ktable = unsafe { ActivePageTable::new(TableKind::Kernel) }; let mut new_utable = unsafe { - let frame = allocate_frames(1).expect("no more frames in syscall::clone new_table"); + let frame = allocate_frames(1).ok_or(Error::new(ENOMEM))?; // SAFETY: This is safe because the frame is exclusive, owned, and valid, as we // have just allocated it. InactivePageTable::new(&mut active_utable, frame)