From 5f4978a6dc91f2c60546a3818f2dbdf5228c30d9 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Wed, 23 Dec 2020 18:42:30 +0100 Subject: [PATCH] Return ENOMEM rather than panicking for PML4 alloc. --- src/syscall/process.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 79629226..2f863d9f 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) -- GitLab