Skip to contentSkip to conversation

drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c:1202 qlcnic_get_strings() error: __builtin_memcpy() '*qlcnic_gstrings_test' too small (32 vs 192)

PATCH kernel test robot 1 participant 1 message Nov 23

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Unfiltered warning: this smatch report is sent as-is and has not been reviewed for false positives, so please treat it with due skepticism.

BCC: [email protected]
CC: [email protected]
TO: [email protected]

tree:   https://android.googlesource.com/kernel/common android15-6.6
head:   a5c942b8c5be461264ec25e7893e53fda4144a3a
commit: c3e439cb04cf6988551994a2a7cb03cda2355ce5 [1/1] kasan, fortify: properly rename memintrinsics

:::::: branch date: 8 hours ago
:::::: commit date: 2 years, 5 months ago
config: x86_64-randconfig-2200-20261123 (https://download.01.org/0day-ci/archive/20261123/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c:1202 qlcnic_get_strings() error: __builtin_memcpy() '*qlcnic_gstrings_test' too small (32 vs 192) drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c:2655 bnx2x_get_vf_config() error: __builtin_memcpy() '&bulletin->vlan' too small (2 vs 4)

vim +1202 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c

af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1193  
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1194  static void
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1195  qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 *data)
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1196  {
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1197  	struct qlcnic_adapter *adapter = netdev_priv(dev);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1198  	int index, i, num_stats;
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1199  
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1200  	switch (stringset) {
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1201  	case ETH_SS_TEST:
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13 @1202  		memcpy(data, *qlcnic_gstrings_test,
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1203  		       QLCNIC_TEST_LEN * ETH_GSTRING_LEN);
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1204  		break;
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1205  	case ETH_SS_STATS:
f27c75b3903ab0 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-11-04  1206  		num_stats = ARRAY_SIZE(qlcnic_tx_queue_stats_strings);
34e8c406fda5b5 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-11-04  1207  		for (i = 0; i < adapter->drv_tx_rings; i++) {
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1208  			for (index = 0; index < num_stats; index++) {
f27c75b3903ab0 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-11-04  1209  				sprintf(data, "tx_queue_%d %s", i,
f27c75b3903ab0 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-11-04  1210  					qlcnic_tx_queue_stats_strings[index]);
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1211  				data += ETH_GSTRING_LEN;
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1212  			}
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1213  		}
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1214  
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1215  		for (index = 0; index < QLCNIC_STATS_LEN; index++) {
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1216  			memcpy(data + index * ETH_GSTRING_LEN,
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1217  			       qlcnic_gstrings_stats[index].stat_string,
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1218  			       ETH_GSTRING_LEN);
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1219  		}
aa4a1f7df7cbb9 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Himanshu Madhani   2013-08-21  1220  
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1221  		if (qlcnic_83xx_check(adapter)) {
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1222  			num_stats = ARRAY_SIZE(qlcnic_83xx_tx_stats_strings);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1223  			for (i = 0; i < num_stats; i++, index++)
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1224  				memcpy(data + index * ETH_GSTRING_LEN,
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1225  				       qlcnic_83xx_tx_stats_strings[i],
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1226  				       ETH_GSTRING_LEN);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1227  			num_stats = ARRAY_SIZE(qlcnic_83xx_mac_stats_strings);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1228  			for (i = 0; i < num_stats; i++, index++)
54a8997c6a0266 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Jitendra Kalsaria  2012-04-26  1229  				memcpy(data + index * ETH_GSTRING_LEN,
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1230  				       qlcnic_83xx_mac_stats_strings[i],
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1231  				       ETH_GSTRING_LEN);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1232  			num_stats = ARRAY_SIZE(qlcnic_83xx_rx_stats_strings);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1233  			for (i = 0; i < num_stats; i++, index++)
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1234  				memcpy(data + index * ETH_GSTRING_LEN,
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1235  				       qlcnic_83xx_rx_stats_strings[i],
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1236  				       ETH_GSTRING_LEN);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1237  			return;
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1238  		} else {
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1239  			num_stats = ARRAY_SIZE(qlcnic_83xx_mac_stats_strings);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1240  			for (i = 0; i < num_stats; i++, index++)
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1241  				memcpy(data + index * ETH_GSTRING_LEN,
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1242  				       qlcnic_83xx_mac_stats_strings[i],
54a8997c6a0266 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Jitendra Kalsaria  2012-04-26  1243  				       ETH_GSTRING_LEN);
54a8997c6a0266 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Jitendra Kalsaria  2012-04-26  1244  		}
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1245  		if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED))
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1246  			return;
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1247  		num_stats = ARRAY_SIZE(qlcnic_device_gstrings_stats);
7e38d04bcb405e drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c Sony Chacko        2013-01-01  1248  		for (i = 0; i < num_stats; index++, i++) {
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1249  			memcpy(data + index * ETH_GSTRING_LEN,
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1250  			       qlcnic_device_gstrings_stats[i],
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1251  			       ETH_GSTRING_LEN);
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1252  		}
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1253  	}
af19b49152bdb6 drivers/net/qlcnic/qlcnic_ethtool.c                 Amit Kumar Salecha 2010-01-13  1254  }
3666e0b04f092f drivers/net/qlcnic/qlcnic_ethtool.c                 amit salecha       2010-10-18  1255  

:::::: The code at line 1202 was first introduced by commit
:::::: af19b49152bdb68fda894183e88096d6d1aa5c3d qlcnic: Qlogic ethernet driver for CNA devices

:::::: TO: Amit Kumar Salecha <[email protected]> :::::: CC: David S. Miller <[email protected]>

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