diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-01 11:37:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-01 11:37:40 +0200 |
commit | 8d4d1c74579b52b32b9484a7a7ce4d6b0d9dab94 (patch) | |
tree | 854d08969b88bc6897a4daa0884cda2f42646b1d /Kernel/Syscalls/process.cpp | |
parent | 6c1ba09fbdeb2c1df0593e017b944a5d2af767d8 (diff) | |
download | serenity-8d4d1c74579b52b32b9484a7a7ce4d6b0d9dab94.zip |
Kernel: Use Userspace<T> in more syscalls
Diffstat (limited to 'Kernel/Syscalls/process.cpp')
-rw-r--r-- | Kernel/Syscalls/process.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Kernel/Syscalls/process.cpp b/Kernel/Syscalls/process.cpp index e622a42837..c081756785 100644 --- a/Kernel/Syscalls/process.cpp +++ b/Kernel/Syscalls/process.cpp @@ -55,23 +55,20 @@ int Process::sys$set_process_icon(int icon_id) return 0; } -int Process::sys$get_process_name(char* buffer, int buffer_size) +int Process::sys$get_process_name(Userspace<char*> buffer, size_t buffer_size) { REQUIRE_PROMISE(stdio); - if (buffer_size <= 0) - return -EINVAL; - if (!validate_write(buffer, buffer_size)) return -EFAULT; - if (m_name.length() + 1 > (size_t)buffer_size) + if (m_name.length() + 1 > buffer_size) return -ENAMETOOLONG; copy_to_user(buffer, m_name.characters(), m_name.length() + 1); return 0; } -int Process::sys$set_process_name(const char* user_name, size_t user_name_length) +int Process::sys$set_process_name(Userspace<const char*> user_name, size_t user_name_length) { REQUIRE_PROMISE(proc); if (user_name_length > 256) |