mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
rust: binder: use strict provenance APIs
Replace the pointer-to-integer conversions in the Binder Rust driver
with calls to the strict provenance APIs.
The strict provenance APIs were stabilized in Rust 1.84.0 [1]. Since
commit f32fb9c58a ("rust: bump Rust minimum supported version to
1.85.0 (Debian Trixie)"), the minimum supported Rust version is 1.85.0,
so no polyfills are needed.
Link: https://blog.rust-lang.org/2025/01/09/Rust-1.84.0.html#strict-provenance-apis [1]
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Assisted-by: Codex:gpt-5
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260526-binder-strict-provenance-v2-1-a41d89c29bc5@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dc59e4fea9
commit
32782e3115
|
|
@ -321,7 +321,7 @@ pub(crate) unsafe fn remove_node_info(
|
|||
/// An id that is unique across all binder nodes on the system. Used as the key in the
|
||||
/// `by_node` map.
|
||||
pub(crate) fn global_id(&self) -> usize {
|
||||
self as *const Node as usize
|
||||
(self as *const Node).addr()
|
||||
}
|
||||
|
||||
pub(crate) fn get_id(&self) -> (u64, u64) {
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ unsafe impl<T> Sync for AssertSync<T> {}
|
|||
_: *mut kernel::ffi::c_void,
|
||||
) -> kernel::ffi::c_int {
|
||||
// SAFETY: Accessing the private field of `seq_file` is okay.
|
||||
let pid = (unsafe { (*ptr).private }) as usize as Pid;
|
||||
let pid = unsafe { (*ptr).private }.addr() as Pid;
|
||||
// SAFETY: The caller ensures that the pointer is valid and exclusive for the duration in which
|
||||
// this method is called.
|
||||
let m = unsafe { SeqFile::from_raw(ptr) };
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user