mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tamir Duberstein <tamird@kernel.org>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	 Tamir Duberstein <tamird@kernel.org>
Subject: [PATCH 2/6] rust: binder: transmute transaction data
Date: Fri, 22 May 2026 19:12:47 +0200	[thread overview]
Message-ID: <20260522-binder-strict-provenance-v1-2-3d6e9406e864@kernel.org> (raw)
In-Reply-To: <20260522-binder-strict-provenance-v1-0-3d6e9406e864@kernel.org>

`BinderTransactionData` is a transparent wrapper around
`binder_transaction_data`. Use a transmute to view the transaction data in
`BinderTransactionDataSecctx` through that wrapper, matching the safety
argument at the conversion site and avoiding the raw pointer round trip.

Signed-off-by: Tamir Duberstein <tamird@kernel.org>
---
 drivers/android/binder/defs.rs | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/android/binder/defs.rs b/drivers/android/binder/defs.rs
index 33f51b4139c7..fd0ef3f9ebd1 100644
--- a/drivers/android/binder/defs.rs
+++ b/drivers/android/binder/defs.rs
@@ -164,10 +164,7 @@ impl BinderTransactionDataSecctx {
     /// View the inner data as wrapped in `BinderTransactionData`.
     pub(crate) fn tr_data(&mut self) -> &mut BinderTransactionData {
         // SAFETY: Transparent wrapper is safe to transmute.
-        unsafe {
-            &mut *(&mut self.transaction_data as *mut uapi::binder_transaction_data
-                as *mut BinderTransactionData)
-        }
+        unsafe { core::mem::transmute(&mut self.transaction_data) }
     }
 }
 

-- 
2.54.0


  parent reply	other threads:[~2026-05-22 17:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 17:12 [PATCH 0/6] rust: binder: reduce `as` casts Tamir Duberstein
2026-05-22 17:12 ` [PATCH 1/6] rust: binder: use strict provenance APIs Tamir Duberstein
2026-05-26 12:32   ` Alice Ryhl
2026-05-27 11:10   ` Gary Guo
2026-05-22 17:12 ` Tamir Duberstein [this message]
2026-05-26 12:33   ` [PATCH 2/6] rust: binder: transmute transaction data Alice Ryhl
2026-05-26 13:33     ` Tamir Duberstein
2026-05-26 13:36       ` Alice Ryhl
2026-05-26 13:39         ` Tamir Duberstein
2026-05-26 13:42           ` Alice Ryhl
2026-05-26 16:30             ` Tamir Duberstein
2026-05-26 17:47               ` Miguel Ojeda
2026-05-26 18:00                 ` Tamir Duberstein
2026-05-26 19:21                   ` Miguel Ojeda
2026-05-22 17:12 ` [PATCH 3/6] rust: binder: enable `clippy::ptr_as_ptr` lint Tamir Duberstein
2026-05-26 12:34   ` Alice Ryhl
2026-05-22 17:12 ` [PATCH 4/6] rust: binder: enable `clippy::ref_as_ptr` lint Tamir Duberstein
2026-05-26 12:46   ` Alice Ryhl
2026-05-26 13:37     ` Tamir Duberstein
2026-05-22 17:12 ` [PATCH 5/6] rust: binder: enable `clippy::as_underscore` Tamir Duberstein
2026-05-26 12:44   ` Alice Ryhl
2026-05-26 17:30     ` Tamir Duberstein
2026-05-22 17:12 ` [PATCH 6/6] rust: binder: enable `clippy::cast_lossless` Tamir Duberstein
2026-05-26 12:44   ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522-binder-strict-provenance-v1-2-3d6e9406e864@kernel.org \
    --to=tamird@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tkjos@android.com \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®