ANDROID: rust: allow zero init for KABI members
Allow all-zero initialization for structures that have KABI padding
added. Otherwise, the new __kabi_reserved* fields would need to be
individually initialized. This fixes reported errors such as:
error[E0063]: missing field `__kabi_reserved1` in initializer of `blk_mq_ops`
--> /proc/self/cwd/common/rust/kernel/block/mq/operations.rs:216:42
|
216 | const VTABLE: bindings::blk_mq_ops = bindings::blk_mq_ops {
| ^^^^^^^^^^^^^^^^^^^^ missing `__kabi_reserved1`
Bug: 151154716
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Matthew Maurer <mmaurer@google.com>
Cc: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If7996037e95b3947eb3b3afa9513cff18f4be116
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
@@ -134,6 +134,8 @@ impl GenDiskBuilder {
|
||||
pr_ops: core::ptr::null_mut(),
|
||||
free_disk: None,
|
||||
poll_bio: None,
|
||||
// SAFETY: Allow all zeros because of Android KABI members
|
||||
..unsafe { core::mem::MaybeUninit::zeroed().assume_init() }
|
||||
};
|
||||
|
||||
// SAFETY: `gendisk` is a valid pointer as we initialized it above
|
||||
|
||||
@@ -237,6 +237,8 @@ impl<T: Operations> OperationsVTable<T> {
|
||||
map_queues: None,
|
||||
#[cfg(CONFIG_BLK_DEBUG_FS)]
|
||||
show_rq: None,
|
||||
// SAFETY: Allow all zeros because of Android KABI members
|
||||
..unsafe { core::mem::MaybeUninit::zeroed().assume_init() }
|
||||
};
|
||||
|
||||
pub(crate) const fn build() -> &'static bindings::blk_mq_ops {
|
||||
|
||||
Reference in New Issue
Block a user