Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: auxiliary: use `pin_init::zeroed()` for device ID

Replace the previous `unsafe { core::mem::zeroed() }` initialization
for `bindings::auxillary_device_id` with `pin_init::zeroed()`. This removes
the explicit unsafe block and uses the safer pinned zero-initialization
helper.

Suggested-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
Link: https://github.com/Rust-for-Linux/linux/issues/1189
Link: https://patch.msgid.link/20251129124706.26263-1-atharvd440@gmail.com
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Atharv Dubey and committed by
Danilo Krummrich
1cab0874 ae3bf761

+1 -6
+1 -6
rust/kernel/auxiliary.rs
··· 121 121 let name = name.to_bytes_with_nul(); 122 122 let modname = modname.to_bytes_with_nul(); 123 123 124 - // TODO: Replace with `bindings::auxiliary_device_id::default()` once stabilized for 125 - // `const`. 126 - // 127 - // SAFETY: FFI type is valid to be zero-initialized. 128 - let mut id: bindings::auxiliary_device_id = unsafe { core::mem::zeroed() }; 129 - 124 + let mut id: bindings::auxiliary_device_id = pin_init::zeroed(); 130 125 let mut i = 0; 131 126 while i < modname.len() { 132 127 id.name[i] = modname[i];