Thread (3 messages) 3 messages, 2 authors, 2021-09-16
STALE1730d

[PATCH] usb: musb: tusb6010: uninitialized data in tusb_fifo_write_unaligned()

From: Dan Carpenter <hidden>
Date: 2021-09-15 10:37:19
Also in: kernel-janitors
Subsystem: musb multipoint high speed dual-role controller, the rest, usb subsystem · Maintainers: Bin Liu, Linus Torvalds, Greg Kroah-Hartman

This is writing to the first 1 - 3 bytes of "len" and then writing all
four bytes to musb_writel().  The last byte is always going to be
garbage.  Zero out the last bytes instead.

Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support")
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/usb/musb/tusb6010.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index c42937692207..c510fb84faa6 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -190,6 +190,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len)
 	}
 	if (len > 0) {
 		/* Write the rest 1 - 3 bytes to FIFO */
+		len = 0;
 		memcpy(&val, buf, len);
 		musb_writel(fifo, 0, val);
 	}
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help