1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

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.
This commit is contained in:
Andreas Kling 2021-08-14 23:00:06 +02:00
parent 9509433e25
commit 0f6f863382
4 changed files with 21 additions and 15 deletions

View file

@ -970,9 +970,13 @@ KResultOr<FlatPtr> Process::sys$execve(Userspace<const Syscall::SC_execve_params
if (!copy_from_user(strings.data(), list.strings, size.value()))
return false;
for (size_t i = 0; i < list.length; ++i) {
auto string = copy_string_from_user(strings[i]);
if (string.is_null())
auto string_or_error = try_copy_kstring_from_user(strings[i]);
if (string_or_error.is_error()) {
// FIXME: Propagate the error.
return false;
}
// FIXME: Don't convert to String here, use KString all the way.
auto string = String(string_or_error.value()->view());
if (!output.try_append(move(string)))
return false;
}