Use KVVec::zeroed() to initialize the firmware object's leading zero padding.
Signed-off-by: Thorsten Blum <[email protected]> --- Changes in v3: - Drop the hunk that could panic for now (Alexandre) - v2: https://lore.kernel.org/r/[email protected]/ Changes in v2: - Add a // PANIC comment to copy_from_slice() (Danilo) - v1: https://lore.kernel.org/r/[email protected]/ --- drivers/gpu/nova-core/firmware/fwsec/bootloader.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs b/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs index ec4d92317a93..c487dd9eba82 100644 --- a/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs +++ b/drivers/gpu/nova-core/firmware/fwsec/bootloader.rs @@ -162,8 +162,7 @@ pub(crate) fn new( .ok_or(EOVERFLOW)? }; - let mut firmware_obj = KVVec::new(); - firmware_obj.extend_with(align_padding, 0u8, GFP_KERNEL)?; + let mut firmware_obj = KVVec::zeroed(align_padding, GFP_KERNEL)?; firmware_obj.extend_from_slice(firmware.ucode.0.as_slice(), GFP_KERNEL)?; (
