diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-14 23:00:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-15 12:44:35 +0200 |
commit | 0f6f86338294899fcd0e8cd9961fafbf604fa197 (patch) | |
tree | 3d72edfe04df8a8516bd0ab58ce419a42f551a14 /Kernel/Syscalls/process.cpp | |
parent | 9509433e25455bf8ee98a9ea718c9b4d4c84c7f6 (diff) | |
download | serenity-0f6f86338294899fcd0e8cd9961fafbf604fa197.zip |
Kernel: Convert remaining users of copy_string_from_user()
This patch replaces the remaining users of this API with the new
try_copy_kstring_from_user() instead. Note that we still convert to a
String for continued processing, and I've added FIXME about continuing
work on using KString all the way.
Diffstat (limited to 'Kernel/Syscalls/process.cpp')
-rw-r--r-- | Kernel/Syscalls/process.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Kernel/Syscalls/process.cpp b/Kernel/Syscalls/process.cpp index 3a0c7acb78..200f8b1bb8 100644 --- a/Kernel/Syscalls/process.cpp +++ b/Kernel/Syscalls/process.cpp @@ -41,13 +41,14 @@ KResultOr<FlatPtr> Process::sys$set_process_name(Userspace<const char*> user_nam REQUIRE_PROMISE(proc); if (user_name_length > 256) return ENAMETOOLONG; - auto name = copy_string_from_user(user_name, user_name_length); - if (name.is_null()) - return EFAULT; + auto name_or_error = try_copy_kstring_from_user(user_name, user_name_length); + if (name_or_error.is_error()) + return name_or_error.error(); // Empty and whitespace-only names only exist to confuse users. - if (name.is_whitespace()) + if (name_or_error.value()->view().is_whitespace()) return EINVAL; - m_name = move(name); + // FIXME: There's a String copy here. Process::m_name should be a KString. + m_name = name_or_error.value()->view(); return 0; } |