[PATCH v2 0/5] rust: binder: reduce `as` casts
From: Tamir Duberstein
Date: Tue May 26 2026 - 14:44:36 EST
Follow up on the treewide Clippy lint series [1]. The Rust Binder driver
retains local allows for `clippy::ptr_as_ptr`, `clippy::ref_as_ptr`,
`clippy::as_underscore`, and `clippy::cast_lossless` even though those
lints are enabled for the rest of the kernel.
Fix the Binder violations and remove those allows one lint at a time.
The first patch replaces Binder pointer-to-integer conversions with
calls to the strict provenance APIs now that they are available at the
Rust MSRV.
Link: https://lore.kernel.org/r/20250615-ptr-as-ptr-v12-0-f43b024581e8@xxxxxxxxx [1]
Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxxx>
---
Changes in v2:
- Drop ref-to-ref transmute patch.
- Restore various `as` casts needed for platform compatibility.
- Link to v1: https://patch.msgid.link/20260522-binder-strict-provenance-v1-0-3d6e9406e864@xxxxxxxxxx
To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
To: Arve Hjønnevåg <arve@xxxxxxxxxxx>
To: Todd Kjos <tkjos@xxxxxxxxxxx>
To: Christian Brauner <brauner@xxxxxxxxxx>
To: Carlos Llamas <cmllamas@xxxxxxxxxx>
To: Alice Ryhl <aliceryhl@xxxxxxxxxx>
To: Miguel Ojeda <ojeda@xxxxxxxxxx>
To: Boqun Feng <boqun@xxxxxxxxxx>
To: Gary Guo <gary@xxxxxxxxxxx>
To: Björn Roy Baron <bjorn3_gh@xxxxxxxxxxxxxx>
To: Benno Lossin <lossin@xxxxxxxxxx>
To: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
To: Trevor Gross <tmgross@xxxxxxxxx>
To: Danilo Krummrich <dakr@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: rust-for-linux@xxxxxxxxxxxxxxx
---
Tamir Duberstein (5):
rust: binder: use strict provenance APIs
rust: binder: enable `clippy::ptr_as_ptr` lint
rust: binder: enable `clippy::ref_as_ptr` lint
rust: binder: enable `clippy::as_underscore`
rust: binder: enable `clippy::cast_lossless`
drivers/android/binder/allocation.rs | 4 ++--
drivers/android/binder/defs.rs | 8 +++++---
drivers/android/binder/freeze.rs | 2 +-
drivers/android/binder/node.rs | 14 ++++++++------
drivers/android/binder/node/wrapper.rs | 2 +-
drivers/android/binder/page_range.rs | 8 ++++----
drivers/android/binder/process.rs | 14 +++++++-------
drivers/android/binder/rust_binder_main.rs | 10 ++--------
drivers/android/binder/thread.rs | 24 +++++++++++++-----------
drivers/android/binder/trace.rs | 4 +++-
drivers/android/binder/transaction.rs | 14 ++++++++------
11 files changed, 54 insertions(+), 50 deletions(-)
---
base-commit: fc1ce3afa2e61b4b15e71436ece91b0441a9f4f0
change-id: 20260522-binder-strict-provenance-077c5eddc943
Best regards,
--
Tamir Duberstein <tamird@xxxxxxxxxx>