[linux-next:master 13135/13297] drivers/net/ethernet/sfc/ethtool_common.c:278:32: warning: '%-24s' directive output may be truncated writing between 24 and 31 bytes into a region of size 25

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ae782d4e2bf53b0b642ae860794f7a39470f995a
commit: e8103642f34d340f8c9fc3c56108a9b25cd22a7e [13135/13297] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
config: loongarch-randconfig-r016-20230830 (https://download.01.org/0day-ci/archive/20230830/202308301211.2HHbgs2N-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230830/202308301211.2HHbgs2N-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308301211.2HHbgs2N-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/sfc/ethtool_common.c: In function 'efx_fill_test':
>> drivers/net/ethernet/sfc/ethtool_common.c:278:32: warning: '%-24s' directive output may be truncated writing between 24 and 31 bytes into a region of size 25 [-Wformat-truncation=]
     278 |                          "%-6s %-24s", unit_str, test_str);
         |                                ^~~~~             ~~~~~~~~
   drivers/net/ethernet/sfc/ethtool_common.c:276:17: note: 'snprintf' output 32 or more bytes (assuming 39) into a destination of size 32
     276 |                 snprintf(strings + test_index * ETH_GSTRING_LEN,
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     277 |                          ETH_GSTRING_LEN,
         |                          ~~~~~~~~~~~~~~~~
     278 |                          "%-6s %-24s", unit_str, test_str);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/net/ethernet/sfc/siena/ethtool_common.c: In function 'efx_fill_test':
>> drivers/net/ethernet/sfc/siena/ethtool_common.c:229:32: warning: '%-24s' directive output may be truncated writing between 24 and 31 bytes into a region of size 25 [-Wformat-truncation=]
     229 |                          "%-6s %-24s", unit_str, test_str);
         |                                ^~~~~             ~~~~~~~~
   drivers/net/ethernet/sfc/siena/ethtool_common.c:227:17: note: 'snprintf' output 32 or more bytes (assuming 39) into a destination of size 32
     227 |                 snprintf(strings + test_index * ETH_GSTRING_LEN,
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     228 |                          ETH_GSTRING_LEN,
         |                          ~~~~~~~~~~~~~~~~
     229 |                          "%-6s %-24s", unit_str, test_str);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   drivers/net/ethernet/sfc/falcon/ethtool.c: In function 'ef4_fill_test':
>> drivers/net/ethernet/sfc/falcon/ethtool.c:229:32: warning: '%-24s' directive output may be truncated writing between 24 and 31 bytes into a region of size 25 [-Wformat-truncation=]
     229 |                          "%-6s %-24s", unit_str, test_str);
         |                                ^~~~~             ~~~~~~~~
   drivers/net/ethernet/sfc/falcon/ethtool.c:227:17: note: 'snprintf' output 32 or more bytes (assuming 39) into a destination of size 32
     227 |                 snprintf(strings + test_index * ETH_GSTRING_LEN,
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     228 |                          ETH_GSTRING_LEN,
         |                          ~~~~~~~~~~~~~~~~
     229 |                          "%-6s %-24s", unit_str, test_str);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +278 drivers/net/ethernet/sfc/ethtool_common.c

bdccfd2d4ea7a0 Edward Cree           2020-06-29  244  
3653954da498fc Alex Maftei (amaftei  2020-01-10  245) /**
3653954da498fc Alex Maftei (amaftei  2020-01-10  246)  * efx_fill_test - fill in an individual self-test entry
3653954da498fc Alex Maftei (amaftei  2020-01-10  247)  * @test_index:		Index of the test
3653954da498fc Alex Maftei (amaftei  2020-01-10  248)  * @strings:		Ethtool strings, or %NULL
3653954da498fc Alex Maftei (amaftei  2020-01-10  249)  * @data:		Ethtool test results, or %NULL
3653954da498fc Alex Maftei (amaftei  2020-01-10  250)  * @test:		Pointer to test result (used only if data != %NULL)
3653954da498fc Alex Maftei (amaftei  2020-01-10  251)  * @unit_format:	Unit name format (e.g. "chan\%d")
3653954da498fc Alex Maftei (amaftei  2020-01-10  252)  * @unit_id:		Unit id (e.g. 0 for "chan0")
3653954da498fc Alex Maftei (amaftei  2020-01-10  253)  * @test_format:	Test name format (e.g. "loopback.\%s.tx.sent")
3653954da498fc Alex Maftei (amaftei  2020-01-10  254)  * @test_id:		Test id (e.g. "PHYXS" for "loopback.PHYXS.tx_sent")
3653954da498fc Alex Maftei (amaftei  2020-01-10  255)  *
3653954da498fc Alex Maftei (amaftei  2020-01-10  256)  * Fill in an individual self-test entry.
3653954da498fc Alex Maftei (amaftei  2020-01-10  257)  */
428cd523248286 Zhang Xiaoxu          2020-01-13  258  static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data,
3653954da498fc Alex Maftei (amaftei  2020-01-10  259) 			  int *test, const char *unit_format, int unit_id,
3653954da498fc Alex Maftei (amaftei  2020-01-10  260) 			  const char *test_format, const char *test_id)
3653954da498fc Alex Maftei (amaftei  2020-01-10  261) {
3653954da498fc Alex Maftei (amaftei  2020-01-10  262) 	char unit_str[ETH_GSTRING_LEN], test_str[ETH_GSTRING_LEN];
3653954da498fc Alex Maftei (amaftei  2020-01-10  263) 
3653954da498fc Alex Maftei (amaftei  2020-01-10  264) 	/* Fill data value, if applicable */
3653954da498fc Alex Maftei (amaftei  2020-01-10  265) 	if (data)
3653954da498fc Alex Maftei (amaftei  2020-01-10  266) 		data[test_index] = *test;
3653954da498fc Alex Maftei (amaftei  2020-01-10  267) 
3653954da498fc Alex Maftei (amaftei  2020-01-10  268) 	/* Fill string, if applicable */
3653954da498fc Alex Maftei (amaftei  2020-01-10  269) 	if (strings) {
3653954da498fc Alex Maftei (amaftei  2020-01-10  270) 		if (strchr(unit_format, '%'))
3653954da498fc Alex Maftei (amaftei  2020-01-10  271) 			snprintf(unit_str, sizeof(unit_str),
3653954da498fc Alex Maftei (amaftei  2020-01-10  272) 				 unit_format, unit_id);
3653954da498fc Alex Maftei (amaftei  2020-01-10  273) 		else
3653954da498fc Alex Maftei (amaftei  2020-01-10  274) 			strcpy(unit_str, unit_format);
3653954da498fc Alex Maftei (amaftei  2020-01-10  275) 		snprintf(test_str, sizeof(test_str), test_format, test_id);
3653954da498fc Alex Maftei (amaftei  2020-01-10  276) 		snprintf(strings + test_index * ETH_GSTRING_LEN,
3653954da498fc Alex Maftei (amaftei  2020-01-10  277) 			 ETH_GSTRING_LEN,
3653954da498fc Alex Maftei (amaftei  2020-01-10 @278) 			 "%-6s %-24s", unit_str, test_str);
3653954da498fc Alex Maftei (amaftei  2020-01-10  279) 	}
3653954da498fc Alex Maftei (amaftei  2020-01-10  280) }
3653954da498fc Alex Maftei (amaftei  2020-01-10  281) 

:::::: The code at line 278 was first introduced by commit
:::::: 3653954da498fc80c5da3642ae3f8d8168d7f820 sfc: move some ethtool code

:::::: TO: Alex Maftei (amaftei) <amaftei@xxxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux