mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
Kernel/Syscalls: Use copy_n_to_user when applicable
copy_to_user() with bytes as the last argument could be changed to using copy_n_to_user() with a count.
This commit is contained in:
parent
f32fde6152
commit
d0ac24ddbf
5 changed files with 10 additions and 9 deletions
|
@ -43,7 +43,8 @@ ErrorOr<FlatPtr> Process::sys$pipe(Userspace<int*> pipefd, int flags)
|
|||
reader_fd_allocation.fd,
|
||||
writer_fd_allocation.fd,
|
||||
};
|
||||
if (copy_to_user(pipefd, fds_for_userspace, sizeof(fds_for_userspace)).is_error()) {
|
||||
if (copy_n_to_user(pipefd, fds_for_userspace, 2).is_error()) {
|
||||
// Avoid leaking both file descriptors on error.
|
||||
fds[reader_fd_allocation.fd] = {};
|
||||
fds[writer_fd_allocation.fd] = {};
|
||||
return EFAULT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue