Unverified Commit 15ecd83d authored by Pekka Ristola's avatar Pekka Ristola Committed by Christian Brauner
Browse files

rust: file: mark `LocalFile` as `repr(transparent)`

Unsafe code in `LocalFile`'s methods assumes that the type has the same
layout as the inner `bindings::file`. This is not guaranteed by the default
struct representation in Rust, but requires specifying the `transparent`
representation.

The `File` struct (which also wraps `bindings::file`) is already marked as
`repr(transparent)`, so this change makes their layouts equivalent.

Fixes: 85184982 ("rust: file: add Rust abstraction for `struct file`")
Closes: https://github.com/Rust-for-Linux/linux/issues/1165


Signed-off-by: default avatarPekka Ristola <pekkarr@protonmail.com>
Link: https://lore.kernel.org/20250527204636.12573-1-pekkarr@protonmail.com


Reviewed-by: default avatarBenno Lossin <lossin@kernel.org>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 34ecde3c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment