The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] rust: kernel: fix lifetime of copy_from_iter_raw
@ 2026-11-14  2:45 Marwan Mohamed Zein
  2026-11-14  6:30 ` Alexandre Courbot
  0 siblings, 1 reply; 2+ messages in thread
From: Marwan Mohamed Zein @ 2026-11-14  2:45 UTC (permalink / raw)
  To: ojeda
  Cc: rust-for-linux, linux-kernel, boqun, gary, bjorn3_gh, lossin,
	a.hindborg, aliceryhl, tmgross, dakr, daniel.almeida, tamir,
	acourbot, work, martell0x1, spidermana

From: martell0x1 <marawanzein222@gmail.com>

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.

Reported-by: spidermana <xuyiwen14@gmail.com>
Closes: https://github.com/Rust-for-Linux/linux/issues/1265
Signed-off-by: martell0x1 <marawanzein222@gmail.com>
---
 rust/kernel/iov.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/kernel/iov.rs b/rust/kernel/iov.rs
index 43bae8923..8caf04518 100644
--- a/rust/kernel/iov.rs
+++ b/rust/kernel/iov.rs
@@ -161,7 +161,7 @@ pub fn copy_from_iter_vec<A: Allocator>(
     ///
     /// 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>();
 

base-commit: ee83899302a0457a3ba47464a13e8682bd7ba27d
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rust: kernel: fix lifetime of copy_from_iter_raw
  2026-11-14  2:45 [PATCH] rust: kernel: fix lifetime of copy_from_iter_raw Marwan Mohamed Zein
@ 2026-11-14  6:30 ` Alexandre Courbot
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Courbot @ 2026-11-14  6:30 UTC (permalink / raw)
  To: Marwan Mohamed Zein
  Cc: ojeda, rust-for-linux, linux-kernel, boqun, gary, bjorn3_gh,
	lossin, a.hindborg, aliceryhl, tmgross, dakr, daniel.almeida,
	tamir, work, spidermana

On Sat Nov 14, 2026 at 11:45 AM JST, Marwan Mohamed Zein wrote:
> From: martell0x1 <marawanzein222@gmail.com>

Please sign with a full name.

>
> 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.
>
> Reported-by: spidermana <xuyiwen14@gmail.com>
> Closes: https://github.com/Rust-for-Linux/linux/issues/1265
> Signed-off-by: martell0x1 <marawanzein222@gmail.com>

On these tags as well.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-14  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14  2:45 [PATCH] rust: kernel: fix lifetime of copy_from_iter_raw Marwan Mohamed Zein
2026-11-14  6:30 ` Alexandre Courbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox