summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/pledge.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 17:38:37 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-05 17:38:37 +0200
commit48a0b31c478cb78dece459369610e0f993c8f6f0 (patch)
treef08fde80936619aa94f84edb0973878d8810d147 /Kernel/Syscalls/pledge.cpp
parent9903f5c6ef76dfd3c15e63205e307c9519c32ff3 (diff)
downloadserenity-48a0b31c478cb78dece459369610e0f993c8f6f0.zip
Kernel: Make copy_{from,to}_user() return KResult and use TRY()
This makes EFAULT propagation flow much more naturally. :^)
Diffstat (limited to 'Kernel/Syscalls/pledge.cpp')
-rw-r--r--Kernel/Syscalls/pledge.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp
index 5a24406272..0b94bf2b91 100644
--- a/Kernel/Syscalls/pledge.cpp
+++ b/Kernel/Syscalls/pledge.cpp
@@ -13,8 +13,7 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
Syscall::SC_pledge_params params;
- if (!copy_from_user(&params, user_params))
- return EFAULT;
+ TRY(copy_from_user(&params, user_params));
if (params.promises.length > 1024 || params.execpromises.length > 1024)
return E2BIG;