diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2025-10-22 16:30:36 +0200 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2025-11-05 00:35:20 +0100 |
| commit | f2af7b01b05545fff1cea0768c14e2da552a56ee (patch) | |
| tree | b77414a212ffa5ef8e9128165adcd1a498b112db /rust/kernel/alloc/kvec/errors.rs | |
| parent | db7bd1affa852b61dbc0d2ae2809f0f5bf2e3d9d (diff) | |
rust: uaccess: add UserSliceReader::read_slice_partial()
The existing read_slice() method is a wrapper around copy_from_user()
and expects the user buffer to be larger than the destination buffer.
However, userspace may split up writes in multiple partial operations
providing an offset into the destination buffer and a smaller user
buffer.
In order to support this common case, provide a helper for partial
reads.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Matthew Maurer <mmaurer@google.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
[ Replace map_or() with let-else; use saturating_add(). - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions
