diff options
| author | Baptiste Lepers <baptiste.lepers@gmail.com> | 2025-08-12 16:42:11 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-15 12:03:19 +0200 |
| commit | ffe015e8e3f681ca59694da4e56ab873ebd092e3 (patch) | |
| tree | cfa587683850042310dc058ad061c28a1b9ffcd7 /rust | |
| parent | b39970581c6b0a7ad72b19307769b7cf3c2ee932 (diff) | |
rust: cpumask: Mark CpumaskVar as transparent
[ Upstream commit 23fca458f6ab18927e50c2134fb7b60297f18b4e ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'rust')
| -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 3fcbff438670..05e1c882404e 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>, |
