1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 08:47:35 +00:00

Kernel: Make copy_{from,to}_user() return KResult and use TRY()

This makes EFAULT propagation flow much more naturally. :^)
This commit is contained in:
Andreas Kling 2021-09-05 17:38:37 +02:00
parent 9903f5c6ef
commit 48a0b31c47
57 changed files with 318 additions and 551 deletions

View file

@ -36,12 +36,9 @@ KResultOr<FlatPtr> Process::sys$pipe(int pipefd[2], int flags)
m_fds[reader_fd_allocation.fd].set(move(reader_description), fd_flags);
m_fds[writer_fd_allocation.fd].set(move(writer_description), fd_flags);
if (!copy_to_user(&pipefd[0], &reader_fd_allocation.fd))
return EFAULT;
if (!copy_to_user(&pipefd[1], &writer_fd_allocation.fd))
return EFAULT;
return 0;
TRY(copy_to_user(&pipefd[0], &reader_fd_allocation.fd));
TRY(copy_to_user(&pipefd[1], &writer_fd_allocation.fd));
return KSuccess;
}
}