diff options
author | Baptiste Lepers <baptiste.lepers@gmail.com> | 2025-08-12 16:42:11 +0200 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2025-08-14 09:55:47 +0530 |
commit | 23fca458f6ab18927e50c2134fb7b60297f18b4e (patch) | |
tree | 47c6866ce7fcd8401fa83a69d12636e46b259b95 /rust/kernel | |
parent | daad2ef99145215fac1cab196811e3e03ef8bc9f (diff) |
rust: cpumask: Mark CpumaskVar as transparent
Unsafe code in CpumaskVar's methods assumes that the type has the same
layout as `bindings::cpumask_var_t`. This is not guaranteed by
the default struct representation in Rust, but requires specifying the
`transparent` representation.
Fixes: 8961b8cb3099a ("rust: cpumask: Add initial abstractions")
Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r-- | rust/kernel/cpumask.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/rust/kernel/cpumask.rs b/rust/kernel/cpumask.rs index e311ab9038df..c1d17826ae7b 100644 --- a/rust/kernel/cpumask.rs +++ b/rust/kernel/cpumask.rs @@ -212,6 +212,7 @@ impl Cpumask { /// } /// assert_eq!(mask2.weight(), count); /// ``` +#[repr(transparent)] pub struct CpumaskVar { #[cfg(CONFIG_CPUMASK_OFFSTACK)] ptr: NonNull<Cpumask>, |