diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2025-04-16 13:15:43 -0400 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2025-04-23 12:05:23 +0200 |
| commit | 88d5d6a38d5161228fbfe017eb94d777d5e8a0e4 (patch) | |
| tree | 05345b5dedcfeb459934004e67c226c3121fde15 /rust/kernel/uaccess.rs | |
| parent | 1b04b466c873f62413bf65a05a558f036660aedc (diff) | |
rust: alloc: replace `Vec::set_len` with `inc_len`
Rename `set_len` to `inc_len` and simplify its safety contract.
Note that the usage in `CString::try_from_fmt` remains correct as the
receiver is known to have `len == 0`.
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://lore.kernel.org/r/20250416-vec-set-len-v4-4-112b222604cd@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/uaccess.rs')
| -rw-r--r-- | rust/kernel/uaccess.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/uaccess.rs b/rust/kernel/uaccess.rs index 80a9782b1c6e..e4882f113d79 100644 --- a/rust/kernel/uaccess.rs +++ b/rust/kernel/uaccess.rs @@ -290,7 +290,7 @@ impl UserSliceReader { // SAFETY: Since the call to `read_raw` was successful, so the next `len` bytes of the // vector have been initialized. - unsafe { buf.set_len(buf.len() + len) }; + unsafe { buf.inc_len(len) }; Ok(()) } } |