diff options
| author | Marwan Mohamed Zein <marawanzein222@gmail.com> | 2026-11-14 15:21:55 +0200 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-11-17 07:31:52 +0100 |
| commit | df71affdd95ea60fa3fb31e666389a53fd3297db (patch) | |
| tree | 0a820e2bc095e71ff9406b6f3573ac065a3109c2 | |
| parent | 1eaa31fa41125db78a50abef7f0a35aa22af40d0 (diff) | |
rust: iov: fix return lifetime of `copy_from_iter_raw()`
The returned slice is derived from `out`, but lifetime elision
ties it to `self` because this is a method. Explicitly bind the
return lifetime to `out` so the returned slice cannot outlive
its backing buffer.
Fixes: 06cb58b310ea ("rust: iov: add iov_iter abstractions for ITER_SOURCE")
Cc: stable@vger.kernel.org
Reported-by: spidermana <xuyiwen14@gmail.com>
Closes: https://github.com/Rust-for-Linux/linux/issues/1265
Signed-off-by: Marwan Mohamed Zein <marawanzein222@gmail.com>
Link: https://patch.msgid.link/20261114132156.49243-1-marawanzein222@gmail.com
[ Reworded title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
| -rw-r--r-- | rust/kernel/iov.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/iov.rs b/rust/kernel/iov.rs index 43bae8923c46..8caf04518047 100644 --- a/rust/kernel/iov.rs +++ b/rust/kernel/iov.rs @@ -161,7 +161,7 @@ impl<'data> IovIterSource<'data> { /// /// This will never write uninitialized bytes to the provided buffer. #[inline] - pub fn copy_from_iter_raw(&mut self, out: &mut [MaybeUninit<u8>]) -> &mut [u8] { + pub fn copy_from_iter_raw<'a>(&mut self, out: &'a mut [MaybeUninit<u8>]) -> &'a mut [u8] { let capacity = out.len(); let out = out.as_mut_ptr().cast::<u8>(); |
