mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
Kernel: Make UserOrKernelBuffer::for_user_buffer() return ErrorOr<T>
This simplifies EFAULT propagation with TRY(). :^)
This commit is contained in:
parent
b820ae2828
commit
f2c3a41a8f
Notes:
sideshowbarker
2024-07-18 00:53:53 +09:00
Author: https://github.com/awesomekling
Commit: f2c3a41a8f
7 changed files with 27 additions and 47 deletions
|
@ -16,10 +16,8 @@ ErrorOr<FlatPtr> Process::sys$get_dir_entries(int fd, Userspace<void*> user_buff
|
|||
if (user_size > NumericLimits<ssize_t>::max())
|
||||
return EINVAL;
|
||||
auto description = TRY(fds().open_file_description(fd));
|
||||
auto buffer = UserOrKernelBuffer::for_user_buffer(user_buffer, static_cast<size_t>(user_size));
|
||||
if (!buffer.has_value())
|
||||
return EFAULT;
|
||||
auto count = TRY(description->get_dir_entries(buffer.value(), user_size));
|
||||
auto buffer = TRY(UserOrKernelBuffer::for_user_buffer(user_buffer, static_cast<size_t>(user_size)));
|
||||
auto count = TRY(description->get_dir_entries(buffer, user_size));
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue