[PATCH 2/4] usb: gadget: renesas_usb3: initialize debugfs command buffer

From: Jiale Yao

Date: Wed Oct 21 2026 - 06:50:27 EST


renesas_usb3_b_device_write() copies user input into an uninitialized
stack buffer before comparing it as a command. A zero-length write makes
strncmp() inspect an uninitialized byte.

Zero-initialize the buffer so the copied input is always terminated.

Fixes: 43ba968b00ea ("usb: gadget: udc: renesas_usb3: add debugfs to set the b-device mode")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index 2c9c3e935a5e..baa654f616f7 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -2613,7 +2613,7 @@ static ssize_t renesas_usb3_b_device_write(struct file *file,
{
struct seq_file *s = file->private_data;
struct renesas_usb3 *usb3 = s->private;
- char buf[32];
+ char buf[32] = { };

if (!usb3->driver)
return -ENODEV;
--
2.34.1