Re: [PATCH] rust: init: fix `Zeroable` implementation for `Option<NonNull<T>>` and `Option<KBox<T>>`

From: Miguel Ojeda
Date: Wed Mar 05 2025 - 18:05:17 EST


On Wed, Mar 5, 2025 at 2:29 PM Benno Lossin <benno.lossin@xxxxxxxxx> wrote:
>
> According to [1], `NonNull<T>` and `#[repr(transparent)]` wrapper types
> such as our custom `KBox<T>` have the null pointer optimization only if
> `T: Sized`. Thus remove the `Zeroable` implementation for the unsized
> case.
>
> Link: https://doc.rust-lang.org/stable/std/option/index.html#representation [1]
> Cc: stable@xxxxxxxxxxxxxxx # v6.12+ (a custom patch will be needed for 6.6.y)
> Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed` function")
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>

Applied to `rust-fixes` -- thanks everyone!

[ Added Closes tag and moved up the Reported-by one. - Miguel ]

Cheers,
Miguel