1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:57:36 +00:00

Kernel: Use TRY() in sys$perf_register_string()

This commit is contained in:
Andreas Kling 2021-09-05 18:09:48 +02:00
parent 77b7a44691
commit 17933b193a

View file

@ -25,11 +25,8 @@ KResultOr<FlatPtr> Process::sys$perf_register_string(Userspace<char const*> user
if (!events_buffer) if (!events_buffer)
return KSuccess; return KSuccess;
auto string_or_error = try_copy_kstring_from_user(user_string, user_string_length); auto string = TRY(try_copy_kstring_from_user(user_string, user_string_length));
if (string_or_error.is_error()) return events_buffer->register_string(move(string));
return string_or_error.error();
return events_buffer->register_string(string_or_error.release_value());
} }
} }