[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DE1IJMY33LSW.2X8N4PYXFITVB@kernel.org>
Date: Thu, 06 Nov 2025 10:44:06 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: <abdiel.janulgue@...il.com>, <daniel.almeida@...labora.com>,
<robin.murphy@....com>, <a.hindborg@...nel.org>, <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>
Cc: <linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH 1/2] rust: dma: make use of start_ptr() and
start_ptr_mut()
On Mon Nov 3, 2025 at 8:06 PM CET, Danilo Krummrich wrote:
> @@ -576,7 +580,7 @@ pub fn item_from_index(&self, offset: usize) -> Result<*mut T> {
> // and we've just checked that the range and index is within bounds.
> // - `offset` can't overflow since it is smaller than `self.count` and we've checked
> // that `self.count` won't overflow early in the constructor.
> - Ok(unsafe { self.cpu_addr.add(offset) })
> + Ok(unsafe { self.start_ptr().cast_mut().add(offset) })
In this specific case start_ptr().cast_mut() is indeed a bit odd, I will use the
following hunk instead and keep the raw access.
@@ -576,7 +580,7 @@ pub fn item_from_index(&self, offset: usize) -> Result<*mut T> {
// and we've just checked that the range and index is within bounds.
// - `offset` can't overflow since it is smaller than `self.count` and we've checked
// that `self.count` won't overflow early in the constructor.
- Ok(unsafe { self.cpu_addr.add(offset) })
+ Ok(unsafe { self.cpu_addr.get().add(offset) })
Powered by blists - more mailing lists