Re: [PATCH v2] rust: iommu: replace core::mem::zeroed with Zeroable::zeroed
From: Gary Guo
Date: Thu Jul 02 2026 - 07:11:46 EST
On Mon Jun 29, 2026 at 9:10 PM BST, Nicolás Antinori wrote:
> All types in `bindings` implement `Zeroable` if they can. This enables
> using `Zeroable::zeroed` for `io_pgtable_cfg` initialization instead
> of relying on `..unsafe { core::mem::zeroed() }`.
>
> This change improves readability and removes an unnecessary unsafe
> block.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1189
> Suggested-by: Benno Lossin <lossin@xxxxxxxxxx>
> Signed-off-by: Nicolás Antinori <nico.antinori.7@xxxxxxxxx>
Acked-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> Changelog:
> v2: replaced `..pin_init::zeroed()` with `..Zeroable::zeroed()` as
> discussed in v1 thread.
> v1:
> https://lore.kernel.org/rust-for-linux/20260626203122.713317-1-nico.antinori.7@xxxxxxxxx/T/#u
>
> rust/kernel/iommu/pgtable.rs | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)