public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4
@ 2024-07-29 22:08 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2024-07-29 22:08 UTC (permalink / raw)
  To: Krishna Kurapati; +Cc: oe-kbuild-all, linux-kernel, Johan Hovold

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6b5faec9f564ea627c66064a4a6a5904fe5a07dd
commit: 3f12222a4bebeb13ce06ddecc1610ad32fa835dd usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call
date:   3 months ago
config: x86_64-randconfig-071-20240730 (https://download.01.org/0day-ci/archive/20240730/202407300647.A8UggFiR-lkp@intel.com/config)
compiler: gcc-8 (Ubuntu 8.4.0-3ubuntu2) 8.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240730/202407300647.A8UggFiR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407300647.A8UggFiR-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/core.c: In function 'dwc3_core_init':
>> drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                                  ^~
   drivers/usb/dwc3/core.c:1499:41: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                            ^~~~~~~~~
   drivers/usb/dwc3/core.c:1499:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc3/core.c:1482:48: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                                   ^~
   drivers/usb/dwc3/core.c:1482:42: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                             ^~~~~~~~~
   drivers/usb/dwc3/core.c:1482:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1499 drivers/usb/dwc3/core.c

  1445	
  1446	static int dwc3_core_get_phy(struct dwc3 *dwc)
  1447	{
  1448		struct device		*dev = dwc->dev;
  1449		struct device_node	*node = dev->of_node;
  1450		char phy_name[9];
  1451		int ret;
  1452		u8 i;
  1453	
  1454		if (node) {
  1455			dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  1456			dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
  1457		} else {
  1458			dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
  1459			dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
  1460		}
  1461	
  1462		if (IS_ERR(dwc->usb2_phy)) {
  1463			ret = PTR_ERR(dwc->usb2_phy);
  1464			if (ret == -ENXIO || ret == -ENODEV)
  1465				dwc->usb2_phy = NULL;
  1466			else
  1467				return dev_err_probe(dev, ret, "no usb2 phy configured\n");
  1468		}
  1469	
  1470		if (IS_ERR(dwc->usb3_phy)) {
  1471			ret = PTR_ERR(dwc->usb3_phy);
  1472			if (ret == -ENXIO || ret == -ENODEV)
  1473				dwc->usb3_phy = NULL;
  1474			else
  1475				return dev_err_probe(dev, ret, "no usb3 phy configured\n");
  1476		}
  1477	
  1478		for (i = 0; i < dwc->num_usb2_ports; i++) {
  1479			if (dwc->num_usb2_ports == 1)
  1480				snprintf(phy_name, sizeof(phy_name), "usb2-phy");
  1481			else
  1482				snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
  1483	
  1484			dwc->usb2_generic_phy[i] = devm_phy_get(dev, phy_name);
  1485			if (IS_ERR(dwc->usb2_generic_phy[i])) {
  1486				ret = PTR_ERR(dwc->usb2_generic_phy[i]);
  1487				if (ret == -ENOSYS || ret == -ENODEV)
  1488					dwc->usb2_generic_phy[i] = NULL;
  1489				else
  1490					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1491								phy_name);
  1492			}
  1493		}
  1494	
  1495		for (i = 0; i < dwc->num_usb3_ports; i++) {
  1496			if (dwc->num_usb3_ports == 1)
  1497				snprintf(phy_name, sizeof(phy_name), "usb3-phy");
  1498			else
> 1499				snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
  1500	
  1501			dwc->usb3_generic_phy[i] = devm_phy_get(dev, phy_name);
  1502			if (IS_ERR(dwc->usb3_generic_phy[i])) {
  1503				ret = PTR_ERR(dwc->usb3_generic_phy[i]);
  1504				if (ret == -ENOSYS || ret == -ENODEV)
  1505					dwc->usb3_generic_phy[i] = NULL;
  1506				else
  1507					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1508								phy_name);
  1509			}
  1510		}
  1511	
  1512		return 0;
  1513	}
  1514	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4
@ 2025-03-19  5:06 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-03-19  5:06 UTC (permalink / raw)
  To: Krishna Kurapati; +Cc: oe-kbuild-all, linux-kernel, Johan Hovold

Hi Krishna,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   81e4f8d68c66da301bb881862735bd74c6241a19
commit: 3f12222a4bebeb13ce06ddecc1610ad32fa835dd usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call
date:   11 months ago
config: sparc64-randconfig-001-20250319 (https://download.01.org/0day-ci/archive/20250319/202503191317.9hvDBfeq-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250319/202503191317.9hvDBfeq-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503191317.9hvDBfeq-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/core.c: In function 'dwc3_core_init':
>> drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                                  ^~
   drivers/usb/dwc3/core.c:1499:41: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                            ^~~~~~~~~
   drivers/usb/dwc3/core.c:1499:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc3/core.c:1482:48: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                                   ^~
   drivers/usb/dwc3/core.c:1482:42: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                             ^~~~~~~~~
   drivers/usb/dwc3/core.c:1482:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1499 drivers/usb/dwc3/core.c

  1445	
  1446	static int dwc3_core_get_phy(struct dwc3 *dwc)
  1447	{
  1448		struct device		*dev = dwc->dev;
  1449		struct device_node	*node = dev->of_node;
  1450		char phy_name[9];
  1451		int ret;
  1452		u8 i;
  1453	
  1454		if (node) {
  1455			dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  1456			dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
  1457		} else {
  1458			dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
  1459			dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
  1460		}
  1461	
  1462		if (IS_ERR(dwc->usb2_phy)) {
  1463			ret = PTR_ERR(dwc->usb2_phy);
  1464			if (ret == -ENXIO || ret == -ENODEV)
  1465				dwc->usb2_phy = NULL;
  1466			else
  1467				return dev_err_probe(dev, ret, "no usb2 phy configured\n");
  1468		}
  1469	
  1470		if (IS_ERR(dwc->usb3_phy)) {
  1471			ret = PTR_ERR(dwc->usb3_phy);
  1472			if (ret == -ENXIO || ret == -ENODEV)
  1473				dwc->usb3_phy = NULL;
  1474			else
  1475				return dev_err_probe(dev, ret, "no usb3 phy configured\n");
  1476		}
  1477	
  1478		for (i = 0; i < dwc->num_usb2_ports; i++) {
  1479			if (dwc->num_usb2_ports == 1)
  1480				snprintf(phy_name, sizeof(phy_name), "usb2-phy");
  1481			else
  1482				snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
  1483	
  1484			dwc->usb2_generic_phy[i] = devm_phy_get(dev, phy_name);
  1485			if (IS_ERR(dwc->usb2_generic_phy[i])) {
  1486				ret = PTR_ERR(dwc->usb2_generic_phy[i]);
  1487				if (ret == -ENOSYS || ret == -ENODEV)
  1488					dwc->usb2_generic_phy[i] = NULL;
  1489				else
  1490					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1491								phy_name);
  1492			}
  1493		}
  1494	
  1495		for (i = 0; i < dwc->num_usb3_ports; i++) {
  1496			if (dwc->num_usb3_ports == 1)
  1497				snprintf(phy_name, sizeof(phy_name), "usb3-phy");
  1498			else
> 1499				snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
  1500	
  1501			dwc->usb3_generic_phy[i] = devm_phy_get(dev, phy_name);
  1502			if (IS_ERR(dwc->usb3_generic_phy[i])) {
  1503				ret = PTR_ERR(dwc->usb3_generic_phy[i]);
  1504				if (ret == -ENOSYS || ret == -ENODEV)
  1505					dwc->usb3_generic_phy[i] = NULL;
  1506				else
  1507					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1508								phy_name);
  1509			}
  1510		}
  1511	
  1512		return 0;
  1513	}
  1514	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4
@ 2025-05-26 20:45 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-05-26 20:45 UTC (permalink / raw)
  To: Krishna Kurapati; +Cc: oe-kbuild-all, linux-kernel, Johan Hovold

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   49fffac983ac52aea0ab94914be3f56bcf92d5dc
commit: 3f12222a4bebeb13ce06ddecc1610ad32fa835dd usb: dwc3: core: Fix compile warning on s390 gcc in dwc3_get_phy call
date:   1 year, 1 month ago
config: microblaze-randconfig-2005-20250514 (https://download.01.org/0day-ci/archive/20250527/202505270420.gUbVlmLg-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250527/202505270420.gUbVlmLg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505270420.gUbVlmLg-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/core.c: In function 'dwc3_core_init':
>> drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                                  ^~
   drivers/usb/dwc3/core.c:1499:41: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
                                            ^~~~~~~~~
   drivers/usb/dwc3/core.c:1499:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc3/core.c:1482:48: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                                   ^~
   drivers/usb/dwc3/core.c:1482:42: note: directive argument in the range [0, 2147483647]
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
                                             ^~~~~~~~~
   drivers/usb/dwc3/core.c:1482:4: note: 'snprintf' output between 7 and 16 bytes into a destination of size 9
       snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1499 drivers/usb/dwc3/core.c

  1445	
  1446	static int dwc3_core_get_phy(struct dwc3 *dwc)
  1447	{
  1448		struct device		*dev = dwc->dev;
  1449		struct device_node	*node = dev->of_node;
  1450		char phy_name[9];
  1451		int ret;
  1452		u8 i;
  1453	
  1454		if (node) {
  1455			dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  1456			dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
  1457		} else {
  1458			dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
  1459			dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
  1460		}
  1461	
  1462		if (IS_ERR(dwc->usb2_phy)) {
  1463			ret = PTR_ERR(dwc->usb2_phy);
  1464			if (ret == -ENXIO || ret == -ENODEV)
  1465				dwc->usb2_phy = NULL;
  1466			else
  1467				return dev_err_probe(dev, ret, "no usb2 phy configured\n");
  1468		}
  1469	
  1470		if (IS_ERR(dwc->usb3_phy)) {
  1471			ret = PTR_ERR(dwc->usb3_phy);
  1472			if (ret == -ENXIO || ret == -ENODEV)
  1473				dwc->usb3_phy = NULL;
  1474			else
  1475				return dev_err_probe(dev, ret, "no usb3 phy configured\n");
  1476		}
  1477	
  1478		for (i = 0; i < dwc->num_usb2_ports; i++) {
  1479			if (dwc->num_usb2_ports == 1)
  1480				snprintf(phy_name, sizeof(phy_name), "usb2-phy");
  1481			else
  1482				snprintf(phy_name, sizeof(phy_name),  "usb2-%u", i);
  1483	
  1484			dwc->usb2_generic_phy[i] = devm_phy_get(dev, phy_name);
  1485			if (IS_ERR(dwc->usb2_generic_phy[i])) {
  1486				ret = PTR_ERR(dwc->usb2_generic_phy[i]);
  1487				if (ret == -ENOSYS || ret == -ENODEV)
  1488					dwc->usb2_generic_phy[i] = NULL;
  1489				else
  1490					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1491								phy_name);
  1492			}
  1493		}
  1494	
  1495		for (i = 0; i < dwc->num_usb3_ports; i++) {
  1496			if (dwc->num_usb3_ports == 1)
  1497				snprintf(phy_name, sizeof(phy_name), "usb3-phy");
  1498			else
> 1499				snprintf(phy_name, sizeof(phy_name), "usb3-%u", i);
  1500	
  1501			dwc->usb3_generic_phy[i] = devm_phy_get(dev, phy_name);
  1502			if (IS_ERR(dwc->usb3_generic_phy[i])) {
  1503				ret = PTR_ERR(dwc->usb3_generic_phy[i]);
  1504				if (ret == -ENOSYS || ret == -ENODEV)
  1505					dwc->usb3_generic_phy[i] = NULL;
  1506				else
  1507					return dev_err_probe(dev, ret, "failed to lookup phy %s\n",
  1508								phy_name);
  1509			}
  1510		}
  1511	
  1512		return 0;
  1513	}
  1514	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2025-05-29 11:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 22:08 drivers/usb/dwc3/core.c:1499:47: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2025-03-19  5:06 kernel test robot
2025-05-26 20:45 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox