lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250418014143.888022-17-contact@antoniohickey.com>
Date: Thu, 17 Apr 2025 21:41:37 -0400
From: Antonio Hickey <contact@...oniohickey.com>
To: Abdiel Janulgue <abdiel.janulgue@...il.com>,
	Danilo Krummrich <dakr@...nel.org>,
	Daniel Almeida <daniel.almeida@...labora.com>,
	Robin Murphy <robin.murphy@....com>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>
Cc: Antonio Hickey <contact@...oniohickey.com>,
	rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v6 16/18] rust: dma: refactor to use `&raw [const|mut]`

Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)`
with `&raw const place` and `&raw mut place` respectively.

This will allow us to reduce macro complexity, and improve consistency
with existing reference syntax as `&raw const`, `&raw mut` are similar
to `&`, `&mut` making it fit more naturally with other existing code.

Suggested-by: Benno Lossin <benno.lossin@...ton.me>
Link: https://github.com/Rust-for-Linux/linux/issues/1148
Signed-off-by: Antonio Hickey <contact@...oniohickey.com>
---
 rust/kernel/dma.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/dma.rs b/rust/kernel/dma.rs
index 8cdc76043ee7..8a63c0e83c92 100644
--- a/rust/kernel/dma.rs
+++ b/rust/kernel/dma.rs
@@ -333,7 +333,7 @@ macro_rules! dma_read {
         // dereferenced. The compiler also further validates the expression on whether `field`
         // is a member of `item` when expanded by the macro.
         unsafe {
-            let ptr_field = ::core::ptr::addr_of!((*item) $($field)*);
+            let ptr_field = &raw const ((*item) $($field)*);
             $crate::dma::CoherentAllocation::field_read(&$dma, ptr_field)
         }
     }};
@@ -384,7 +384,7 @@ macro_rules! dma_write {
         // dereferenced. The compiler also further validates the expression on whether `field`
         // is a member of `item` when expanded by the macro.
         unsafe {
-            let ptr_field = ::core::ptr::addr_of_mut!((*item) $(.$field)*);
+            let ptr_field = &raw mut ((*item) $(.$field)*);
             $crate::dma::CoherentAllocation::field_write(&$dma, ptr_field, $val)
         }
     };
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ