Skip to contentSkip to conversation

usb: gadget: udc: renesas_usb3: Fix compiler warning

PATCH Superseded [email protected] 2 participants 3 messages Jan 22, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: udc: renesas_usb3: Fix compiler warning

From: Guo Ren <[email protected]>

drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':
drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]

2638 |   snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~     ^~   ^
Fixes 8292493c22c8 ("riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option")
---
 drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -1
index fce5c41d9f29..89b304cf6d03 100644
@@ -310,7 +310,7 @@ struct renesas_usb3_request {
 	struct list_head	queue;
 };
 
-#define USB3_EP_NAME_SIZE	8
+#define USB3_EP_NAME_SIZE	16
 struct renesas_usb3_ep {
 	struct usb_ep ep;
 	struct renesas_usb3 *usb3;
Signature · 1 line
2.40.1
#1 lore raw

Hello,

Thank you for the patch!

Quoted 10 lines

From: [email protected], Sent: Wednesday, January 22, 2025 11:50 AM

From: Guo Ren <[email protected]>

drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':
drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]

2638 |   snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~     ^~   ^

Just a record. Since the maximum number of ep is up to 16, such an overflow will not occur actually. Anyway, fixing this compiler warning is good.

Quoted 1 line
Fixes 8292493c22c8 ("riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option")

Please use the following Fixes tag:

Fixes 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")

Best regards,
Yoshihiro Shimoda

Quoted 2 lines

<snip URL>

Quoted 22 lines
---
 drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -2
index fce5c41d9f29..89b304cf6d03 100644
@@ -310,7 +310,7 @@ struct renesas_usb3_request {
 	struct list_head	queue;
 };
 
-#define USB3_EP_NAME_SIZE	8
+#define USB3_EP_NAME_SIZE	16
 struct renesas_usb3_ep {
 	struct usb_ep ep;
 	struct renesas_usb3 *usb3;
--

2.40.1

author
#2 lore raw
Quoted 16 lines · Yoshihiro Shimoda

Hello,

Thank you for the patch!

Quoted 10 lines

From: [email protected], Sent: Wednesday, January 22, 2025 11:50 AM

From: Guo Ren <[email protected]>

drivers/usb/gadget/udc/renesas_usb3.c: In function 'renesas_usb3_probe':
drivers/usb/gadget/udc/renesas_usb3.c:2638:73: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 6 [-Wformat-truncation=]

2638 |   snprintf(usb3_ep->ep_name, sizeof(usb3_ep->ep_name), "ep%d", i);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~     ^~   ^
Quoted 8 lines

Just a record. Since the maximum number of ep is up to 16, such an overflow will not occur actually. Anyway, fixing this compiler warning is good.

Quoted 1 line
Fixes 8292493c22c8 ("riscv: Kconfig.socs: Add ARCH_RENESAS kconfig option")

Please use the following Fixes tag:

Fixes 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")

Okay

Quoted 30 lines

Best regards,
Yoshihiro Shimoda

Quoted 2 lines

<snip URL>

Quoted 22 lines
---
 drivers/usb/gadget/udc/renesas_usb3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/renesas_usb3.c +1 -2
index fce5c41d9f29..89b304cf6d03 100644
@@ -310,7 +310,7 @@ struct renesas_usb3_request {
      struct list_head        queue;
 };
 
-#define USB3_EP_NAME_SIZE    8
+#define USB3_EP_NAME_SIZE    16
 struct renesas_usb3_ep {
      struct usb_ep ep;
      struct renesas_usb3 *usb3;
--

2.40.1

Signature · 2 lines
Best Regards
 Guo Ren