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:
parent
9903f5c6ef
commit
48a0b31c47
57 changed files with 318 additions and 551 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue