Re: [PATCH 1/2] rust: dma: make use of start_ptr() and start_ptr_mut()
From: Danilo Krummrich
Date: Thu Nov 06 2025 - 04:44:11 EST
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) })