mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
rust: cpumask: Mark CpumaskVar as transparent
[ Upstream commit23fca458f6] 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:8961b8cb30("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>
This commit is contained in:
parent
b39970581c
commit
ffe015e8e3
|
|
@ -212,6 +212,7 @@ impl Cpumask {
|
|||
/// }
|
||||
/// assert_eq!(mask2.weight(), count);
|
||||
/// ```
|
||||
#[repr(transparent)]
|
||||
pub struct CpumaskVar {
|
||||
#[cfg(CONFIG_CPUMASK_OFFSTACK)]
|
||||
ptr: NonNull<Cpumask>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user