diff options
author | Liav A <liavalb@gmail.com> | 2022-10-29 22:14:49 +0300 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-11-05 18:00:58 -0600 |
commit | d69a0380e1558e82a6a0bda71e66eab121cdcda4 (patch) | |
tree | a15fd0900dbd2c8ab8323377cd6bbe531182e027 | |
parent | 46c6176fad4dd6e25a7a6b4511dd3c3be87113c5 (diff) | |
download | serenity-d69a0380e1558e82a6a0bda71e66eab121cdcda4.zip |
Kernel: Add copy_typed_from_user for non-const Userspace<T*>
-rw-r--r-- | Kernel/StdLib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/StdLib.h b/Kernel/StdLib.h index c54bd20b20..786dddc2b6 100644 --- a/Kernel/StdLib.h +++ b/Kernel/StdLib.h @@ -171,3 +171,11 @@ inline ErrorOr<T> copy_typed_from_user(Userspace<T const*> user_data) TRY(copy_from_user(&data, user_data)); return data; } + +template<typename T> +inline ErrorOr<T> copy_typed_from_user(Userspace<T*> user_data) +{ + T data {}; + TRY(copy_from_user(&data, user_data)); + return data; +} |