[PATCH 0/6] rust: binder: reduce `as` casts

Tamir Duberstein posted 6 patches 2 days, 1 hour ago
drivers/android/binder/allocation.rs       |  4 ++--
drivers/android/binder/defs.rs             |  7 ++-----
drivers/android/binder/freeze.rs           |  2 +-
drivers/android/binder/node.rs             | 12 ++++++------
drivers/android/binder/node/wrapper.rs     |  2 +-
drivers/android/binder/page_range.rs       |  8 ++++----
drivers/android/binder/process.rs          | 12 ++++++------
drivers/android/binder/rust_binder_main.rs | 10 ++--------
drivers/android/binder/thread.rs           | 24 +++++++++++++-----------
drivers/android/binder/trace.rs            |  2 +-
drivers/android/binder/transaction.rs      | 12 ++++++------
11 files changed, 44 insertions(+), 51 deletions(-)
[PATCH 0/6] rust: binder: reduce `as` casts
Posted by Tamir Duberstein 2 days, 1 hour ago
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 two patches reduce related `as` casts outside those lint
enablements: use the strict provenance APIs for Binder
pointer-to-integer conversions now that they are available at the Rust
MSRV, and transmute embedded transaction data directly instead of
round-tripping a reference through raw pointer casts.

Link: https://lore.kernel.org/r/20250615-ptr-as-ptr-v12-0-f43b024581e8@gmail.com [1]
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
---
Tamir Duberstein (6):
      rust: binder: use strict provenance APIs
      rust: binder: transmute transaction data
      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             |  7 ++-----
 drivers/android/binder/freeze.rs           |  2 +-
 drivers/android/binder/node.rs             | 12 ++++++------
 drivers/android/binder/node/wrapper.rs     |  2 +-
 drivers/android/binder/page_range.rs       |  8 ++++----
 drivers/android/binder/process.rs          | 12 ++++++------
 drivers/android/binder/rust_binder_main.rs | 10 ++--------
 drivers/android/binder/thread.rs           | 24 +++++++++++++-----------
 drivers/android/binder/trace.rs            |  2 +-
 drivers/android/binder/transaction.rs      | 12 ++++++------
 11 files changed, 44 insertions(+), 51 deletions(-)
---
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
change-id: 20260522-binder-strict-provenance-077c5eddc943

Best regards,
--  
Tamir Duberstein <tamird@kernel.org>