[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734bhzfgz.fsf@kernel.org>
Date: Mon, 30 Jun 2025 12:33:16 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>
Cc: <abdiel.janulgue@...il.com>, <daniel.almeida@...labora.com>,
<robin.murphy@....com>, <ojeda@...nel.org>, <alex.gaynor@...il.com>,
<boqun.feng@...il.com>, <gary@...yguo.net>, <bjorn3_gh@...tonmail.com>,
<lossin@...nel.org>, <aliceryhl@...gle.com>, <tmgross@...ch.edu>,
<acourbot@...dia.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rust: dma: require mutable reference for as_slice_mut()
and write()
"Danilo Krummrich" <dakr@...nel.org> writes:
> Given the safety requirements of as_slice_mut() and write() taking an
> immutable reference is technically not incorrect.
>
> However, let's leverage the compiler's capabilities and require a
> mutable reference to ensure exclusive access.
>
> This also fixes a clippy warning introduced with 1.88:
>
> warning: mutable borrow from immutable input(s)
> --> rust/kernel/dma.rs:297:78
> |
> 297 | pub unsafe fn as_slice_mut(&self, offset: usize, count: usize) -> Result<&mut [T]> {
> | ^^^^^^^^
>
> Fixes: d37a39f607c4 ("rust: dma: add as_slice/write functions for CoherentAllocation")
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists