[PATCH wireless] wifi: wilc1000: zero-pad SDIO write buffer to block-aligned length
From: Tristan Madani
Date: Sun Oct 25 2026 - 14:19:40 EST
wilc_sdio_write() rounds up the transfer size to 4 bytes via
ALIGN(size, 4) before passing the buffer to the SDIO controller. When
the original size is not 4-byte aligned, the trailing bytes after the
payload are whatever data happens to occupy that memory, and they get
transmitted to the wireless device firmware.
Zero-pad the trailing bytes before the alignment so that no stale data
is sent over the SDIO bus.
Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/wireless/microchip/wilc1000/sdio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c
index 67dea1360f0a8..1a8c7ffcba496 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -441,6 +441,8 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.address = WILC_SDIO_F1_DATA_REG;
}
+ if (size & 3)
+ memset(buf + size, 0, ALIGN(size, 4) - size);
size = ALIGN(size, 4);
nblk = size / block_size;
nleft = size % block_size;
--
2.47.3