Skip to contentSkip to conversation

gpu: nova-core: firmware: fwsec: use KVVec::zeroed() to zero-pad buffer

PATCH Applied Thorsten Blum 3 participants 3 messages Oct 7 – Oct 11

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 gpu: nova-core: firmware: fwsec: use KVVec::zeroed() to zero-pad buffer

Use KVVec::zeroed() to initialize the firmware object's leading zero padding.

---
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(-)
drivers/gpu/nova-core/firmware/fwsec/bootloader.rs +1 -2
index ec4d92317a93..c487dd9eba82 100644
@@ -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)?;
 
             (
maintainer Applied
#2 lore raw
In reply to Thorsten Blum
Quoted 1 line · Thorsten Blum

[PATCH v3] gpu: nova-core: firmware: fwsec: use KVVec::zeroed() to zero-pad buffer

Applied, thanks!

Branch: drm-rust-next
Tree: https://gitlab.freedesktop.org/drm/rust/kernel.git

[1/1] gpu: nova-core: firmware: fwsec: use KVVec::zeroed() to zero-pad buffer

      commit: 5a1b7121a6c4

The patch will appear in the next linux-next integration (typically within 24 hours on weekdays).

The patch is queued up for the upcoming merge window for the next major kernel release.