lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202501090237.e05wLSQD-lkp@intel.com>
Date: Thu, 9 Jan 2025 02:42:04 +0800
From: kernel test robot <lkp@...el.com>
To: Rahul Lakkireddy <rahul.lakkireddy@...lsio.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1355:47: warning:
 '%d' directive output may be truncated writing between 1 and 5 bytes into a
 region of size between 1 and 16

Hi Rahul,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   09a0fa92e5b45e99cf435b2fbf5ebcf889cf8780
commit: 2b465ed00f7db9c5b2aca95a91671f86282b1822 cxgb4: add support for mirror Rxqs
date:   4 years, 6 months ago
config: x86_64-randconfig-a013-20230508 (https://download.01.org/0day-ci/archive/20250109/202501090237.e05wLSQD-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250109/202501090237.e05wLSQD-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501090237.e05wLSQD-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: In function 'cxgb4_port_mirror_alloc_queues':
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1355:47: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 16 [-Wformat-truncation=]
    1355 |                                  "%s-mirrorrxq%d", dev->name, i);
         |                                               ^~
   drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1355:34: note: directive argument in the range [0, 65534]
    1355 |                                  "%s-mirrorrxq%d", dev->name, i);
         |                                  ^~~~~~~~~~~~~~~~
   drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:1353:25: note: 'snprintf' output between 12 and 31 bytes into a destination of size 26
    1353 |                         snprintf(mirror_rxq->msix->desc,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1354 |                                  sizeof(mirror_rxq->msix->desc),
         |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1355 |                                  "%s-mirrorrxq%d", dev->name, i);
         |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1355 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c

  1315	
  1316	static int cxgb4_port_mirror_alloc_queues(struct net_device *dev)
  1317	{
  1318		struct port_info *pi = netdev2pinfo(dev);
  1319		struct adapter *adap = netdev2adap(dev);
  1320		struct sge_eth_rxq *mirror_rxq;
  1321		struct sge *s = &adap->sge;
  1322		int ret = 0, msix = 0;
  1323		u16 i, rxqid;
  1324		u16 *rss;
  1325	
  1326		if (!pi->vi_mirror_count)
  1327			return 0;
  1328	
  1329		if (s->mirror_rxq[pi->port_id])
  1330			return 0;
  1331	
  1332		mirror_rxq = kcalloc(pi->nmirrorqsets, sizeof(*mirror_rxq), GFP_KERNEL);
  1333		if (!mirror_rxq)
  1334			return -ENOMEM;
  1335	
  1336		s->mirror_rxq[pi->port_id] = mirror_rxq;
  1337	
  1338		if (!(adap->flags & CXGB4_USING_MSIX))
  1339			msix = -((int)adap->sge.intrq.abs_id + 1);
  1340	
  1341		for (i = 0, rxqid = 0; i < pi->nmirrorqsets; i++, rxqid++) {
  1342			mirror_rxq = &s->mirror_rxq[pi->port_id][i];
  1343	
  1344			/* Allocate Mirror Rxqs */
  1345			if (msix >= 0) {
  1346				msix = cxgb4_get_msix_idx_from_bmap(adap);
  1347				if (msix < 0) {
  1348					ret = msix;
  1349					goto out_free_queues;
  1350				}
  1351	
  1352				mirror_rxq->msix = &adap->msix_info[msix];
  1353				snprintf(mirror_rxq->msix->desc,
  1354					 sizeof(mirror_rxq->msix->desc),
> 1355					 "%s-mirrorrxq%d", dev->name, i);
  1356			}
  1357	
  1358			init_rspq(adap, &mirror_rxq->rspq,
  1359				  CXGB4_MIRROR_RXQ_DEFAULT_INTR_USEC,
  1360				  CXGB4_MIRROR_RXQ_DEFAULT_PKT_CNT,
  1361				  CXGB4_MIRROR_RXQ_DEFAULT_DESC_NUM,
  1362				  CXGB4_MIRROR_RXQ_DEFAULT_DESC_SIZE);
  1363	
  1364			mirror_rxq->fl.size = CXGB4_MIRROR_FLQ_DEFAULT_DESC_NUM;
  1365	
  1366			ret = t4_sge_alloc_rxq(adap, &mirror_rxq->rspq, false,
  1367					       dev, msix, &mirror_rxq->fl,
  1368					       t4_ethrx_handler, NULL, 0);
  1369			if (ret)
  1370				goto out_free_msix_idx;
  1371	
  1372			/* Setup MSI-X vectors for Mirror Rxqs */
  1373			if (adap->flags & CXGB4_USING_MSIX) {
  1374				ret = request_irq(mirror_rxq->msix->vec,
  1375						  t4_sge_intr_msix, 0,
  1376						  mirror_rxq->msix->desc,
  1377						  &mirror_rxq->rspq);
  1378				if (ret)
  1379					goto out_free_rxq;
  1380	
  1381				cxgb4_set_msix_aff(adap, mirror_rxq->msix->vec,
  1382						   &mirror_rxq->msix->aff_mask, i);
  1383			}
  1384	
  1385			/* Start NAPI for Mirror Rxqs */
  1386			cxgb4_enable_rx(adap, &mirror_rxq->rspq);
  1387		}
  1388	
  1389		/* Setup RSS for Mirror Rxqs */
  1390		rss = kcalloc(pi->rss_size, sizeof(u16), GFP_KERNEL);
  1391		if (!rss) {
  1392			ret = -ENOMEM;
  1393			goto out_free_queues;
  1394		}
  1395	
  1396		mirror_rxq = &s->mirror_rxq[pi->port_id][0];
  1397		for (i = 0; i < pi->rss_size; i++)
  1398			rss[i] = mirror_rxq[i % pi->nmirrorqsets].rspq.abs_id;
  1399	
  1400		ret = cxgb4_config_rss(pi, rss, pi->rss_size, pi->viid_mirror);
  1401		kfree(rss);
  1402		if (ret)
  1403			goto out_free_queues;
  1404	
  1405		return 0;
  1406	
  1407	out_free_rxq:
  1408		free_rspq_fl(adap, &mirror_rxq->rspq, &mirror_rxq->fl);
  1409	
  1410	out_free_msix_idx:
  1411		cxgb4_free_msix_idx_in_bmap(adap, mirror_rxq->msix->idx);
  1412	
  1413	out_free_queues:
  1414		while (rxqid-- > 0)
  1415			cxgb4_port_mirror_free_rxq(adap,
  1416						   &s->mirror_rxq[pi->port_id][rxqid]);
  1417	
  1418		kfree(s->mirror_rxq[pi->port_id]);
  1419		s->mirror_rxq[pi->port_id] = NULL;
  1420		return ret;
  1421	}
  1422	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ