diff options
| author | Alice Ryhl <[email protected]> | 2025-06-16 12:41:48 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2025-07-13 23:34:12 +0000 |
| commit | 17bbbefbf6715a543ff4713e26f7b8e6b7a876d6 (patch) | |
| tree | c0937e87db7f6bb5dcdc1df8a0c5a51161c66f63 /scripts/rustdoc_test_gen.rs | |
| parent | rust: uaccess: add strncpy_from_user (diff) | |
| download | kernel-17bbbefbf6715a543ff4713e26f7b8e6b7a876d6.tar.gz kernel-17bbbefbf6715a543ff4713e26f7b8e6b7a876d6.zip | |
rust: uaccess: add UserSliceReader::strcpy_into_buf
This patch adds a more convenient method for reading C strings from
userspace. Logic is added to NUL-terminate the buffer when necessary so
that a &CStr can be returned.
Note that we treat attempts to read past `self.length` as a fault, so
this returns EFAULT if that limit is exceeded before `buf.len()` is
reached.
Reviewed-by: Danilo Krummrich <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Use `from_mut` to clean `clippy::ref_as_ptr` lint. Reworded
title. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'scripts/rustdoc_test_gen.rs')
0 files changed, 0 insertions, 0 deletions
