1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18: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

@ -155,11 +155,11 @@ KResultOr<FlatPtr> Process::sys$module_unload(Userspace<const char*> user_name,
REQUIRE_NO_PROMISES;
auto module_name = copy_string_from_user(user_name, name_length);
if (module_name.is_null())
return EFAULT;
auto module_name_or_error = try_copy_kstring_from_user(user_name, name_length);
if (module_name_or_error.is_error())
return module_name_or_error.error();
auto it = g_modules->find(module_name);
auto it = g_modules->find(module_name_or_error.value()->view());
if (it == g_modules->end())
return ENOENT;