diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-01 15:04:31 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-01 15:04:31 +0100 |
commit | a1a82c1d95ef8e5932f439483ee11b6a8c424c4c (patch) | |
tree | a61e0bd51c81c47f011df7af04d846aa8711153e /Kernel/Syscalls/get_dir_entries.cpp | |
parent | b5f32be577615f04537d2b8760a5b547c8525aeb (diff) | |
download | serenity-a1a82c1d95ef8e5932f439483ee11b6a8c424c4c.zip |
Kernel: Use Userspace<T> in sys$get_dir_entries()
Diffstat (limited to 'Kernel/Syscalls/get_dir_entries.cpp')
-rw-r--r-- | Kernel/Syscalls/get_dir_entries.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/Syscalls/get_dir_entries.cpp b/Kernel/Syscalls/get_dir_entries.cpp index 627ab8456e..7065a70870 100644 --- a/Kernel/Syscalls/get_dir_entries.cpp +++ b/Kernel/Syscalls/get_dir_entries.cpp @@ -29,18 +29,18 @@ namespace Kernel { -KResultOr<ssize_t> Process::sys$get_dir_entries(int fd, void* buffer, ssize_t size) +KResultOr<ssize_t> Process::sys$get_dir_entries(int fd, Userspace<void*> user_buffer, ssize_t user_size) { REQUIRE_PROMISE(stdio); - if (size < 0) + if (user_size < 0) return EINVAL; auto description = file_description(fd); if (!description) return EBADF; - auto user_buffer = UserOrKernelBuffer::for_user_buffer((u8*)buffer, size); - if (!user_buffer.has_value()) + auto buffer = UserOrKernelBuffer::for_user_buffer(user_buffer, static_cast<size_t>(user_size)); + if (!buffer.has_value()) return EFAULT; - return description->get_dir_entries(user_buffer.value(), size); + return description->get_dir_entries(buffer.value(), user_size); } } |