Commit 15ecd83
rust: file: mark
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: 8518498 ("rust: file: add Rust abstraction for `struct file`")
Closes: Rust-for-Linux/linux#1165
Signed-off-by: Pekka Ristola <[email protected]>
Link: https://lore.kernel.org/[email protected]
Reviewed-by: Benno Lossin <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>LocalFile as repr(transparent)
1 parent 34ecde3 commit 15ecd83
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| |||
0 commit comments