linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: sun4i-usb: Fix a W=1 compilation failure
@ 2023-09-03 10:11 Christophe JAILLET
  2023-09-03 23:58 ` Andre Przywara
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Christophe JAILLET @ 2023-09-03 10:11 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-phy,
	linux-arm-kernel, linux-sunxi

With gcc 12.3.0, when this file is built, we get errors such as:

drivers/phy/allwinner/phy-sun4i-usb.c: In function ‘sun4i_usb_phy_probe’:
drivers/phy/allwinner/phy-sun4i-usb.c:790:52: error: ‘_vbus’ directive output may be truncated writing 5 bytes into a region of size between 2 and 12 [-Werror=format-truncation=]
  790 |                 snprintf(name, sizeof(name), "usb%d_vbus", i);
      |                                                    ^~~~~
drivers/phy/allwinner/phy-sun4i-usb.c:790:17: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
  790 |                 snprintf(name, sizeof(name), "usb%d_vbus", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Because of the possible value of 'i', this can't be an issue in real world
application, but in order to have "make W=1" work correctly, give more
space for 'name'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index ec551464dd4f..e53a9a9317bc 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -782,7 +782,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 
 	for (i = 0; i < data->cfg->num_phys; i++) {
 		struct sun4i_usb_phy *phy = data->phys + i;
-		char name[16];
+		char name[32];
 
 		if (data->cfg->missing_phys & BIT(i))
 			continue;
-- 
2.34.1


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-13 11:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-03 10:11 [PATCH] phy: sun4i-usb: Fix a W=1 compilation failure Christophe JAILLET
2023-09-03 23:58 ` Andre Przywara
2023-09-04 17:57   ` Christophe JAILLET
2023-09-05  9:46     ` Andre Przywara
2023-09-05 10:32   ` Dan Carpenter
2023-09-05 14:13     ` Andre Przywara
2023-09-24 20:01 ` Jernej Škrabec
2023-10-13 10:43 ` Vinod Koul
2023-10-13 11:57   ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).