Skip to contentSkip to conversation

net: ethtool: strset: Allow querying phy stats by index

PATCH kernel test robot 1 participant 1 message Jul 2, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Maxime Chevallier <[email protected]>

Hi Maxime,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Maxime-Chevallier/net-phy-Introduce-ethernet-link-topology-representation/20240701-223116
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240701131801.1227740-13-maxime.chevallier%40bootlin.com
patch subject: [PATCH net-next v14 12/13] net: ethtool: strset: Allow querying phy stats by index

:::::: branch date: 31 hours ago
:::::: commit date: 31 hours ago
config: i386-randconfig-141-20240703 (https://download.01.org/0day-ci/archive/20240703/[email protected]/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)

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:
net/ethtool/strset.c:295 strset_prepare_data() warn: variable dereferenced before check 'info' (see line 283)

vim +/info +295 net/ethtool/strset.c

71921690f9745fe Michal Kubecek    2019-12-27  275  
71921690f9745fe Michal Kubecek    2019-12-27  276  static int strset_prepare_data(const struct ethnl_req_info *req_base,
71921690f9745fe Michal Kubecek    2019-12-27  277  			       struct ethnl_reply_data *reply_base,
f946270d05c2604 Jakub Kicinski    2023-08-14  278  			       const struct genl_info *info)
71921690f9745fe Michal Kubecek    2019-12-27  279  {
71921690f9745fe Michal Kubecek    2019-12-27  280  	const struct strset_req_info *req_info = STRSET_REQINFO(req_base);
71921690f9745fe Michal Kubecek    2019-12-27  281  	struct strset_reply_data *data = STRSET_REPDATA(reply_base);
71921690f9745fe Michal Kubecek    2019-12-27  282  	struct net_device *dev = reply_base->dev;
a0400b1b08fea15 Maxime Chevallier 2024-07-01 @283  	struct nlattr **tb = info->attrs;
a0400b1b08fea15 Maxime Chevallier 2024-07-01  284  	struct phy_device *phydev;
71921690f9745fe Michal Kubecek    2019-12-27  285  	unsigned int i;
71921690f9745fe Michal Kubecek    2019-12-27  286  	int ret;
71921690f9745fe Michal Kubecek    2019-12-27  287  
71921690f9745fe Michal Kubecek    2019-12-27  288  	BUILD_BUG_ON(ARRAY_SIZE(info_template) != ETH_SS_COUNT);
71921690f9745fe Michal Kubecek    2019-12-27  289  	memcpy(&data->sets, &info_template, sizeof(data->sets));
71921690f9745fe Michal Kubecek    2019-12-27  290  
71921690f9745fe Michal Kubecek    2019-12-27  291  	if (!dev) {
71921690f9745fe Michal Kubecek    2019-12-27  292  		for (i = 0; i < ETH_SS_COUNT; i++) {
71921690f9745fe Michal Kubecek    2019-12-27  293  			if ((req_info->req_ids & (1U << i)) &&
71921690f9745fe Michal Kubecek    2019-12-27  294  			    data->sets[i].per_dev) {
71921690f9745fe Michal Kubecek    2019-12-27 @295  				if (info)
71921690f9745fe Michal Kubecek    2019-12-27  296  					GENL_SET_ERR_MSG(info, "requested per device strings without dev");
71921690f9745fe Michal Kubecek    2019-12-27  297  				return -EINVAL;
71921690f9745fe Michal Kubecek    2019-12-27  298  			}
71921690f9745fe Michal Kubecek    2019-12-27  299  		}
ac9c41d5a053e71 Dan Carpenter     2020-01-08  300  		return 0;
71921690f9745fe Michal Kubecek    2019-12-27  301  	}
71921690f9745fe Michal Kubecek    2019-12-27  302  
a0400b1b08fea15 Maxime Chevallier 2024-07-01  303  	phydev = ethnl_req_get_phydev(req_base, tb[ETHTOOL_A_HEADER_FLAGS],
a0400b1b08fea15 Maxime Chevallier 2024-07-01  304  				      info->extack);
a0400b1b08fea15 Maxime Chevallier 2024-07-01  305  
a0400b1b08fea15 Maxime Chevallier 2024-07-01  306  	/* phydev can be NULL, check for errors only */
a0400b1b08fea15 Maxime Chevallier 2024-07-01  307  	if (IS_ERR(phydev))
a0400b1b08fea15 Maxime Chevallier 2024-07-01  308  		return PTR_ERR(phydev);
a0400b1b08fea15 Maxime Chevallier 2024-07-01  309  
71921690f9745fe Michal Kubecek    2019-12-27  310  	ret = ethnl_ops_begin(dev);
71921690f9745fe Michal Kubecek    2019-12-27  311  	if (ret < 0)
71921690f9745fe Michal Kubecek    2019-12-27  312  		goto err_strset;
71921690f9745fe Michal Kubecek    2019-12-27  313  	for (i = 0; i < ETH_SS_COUNT; i++) {
71921690f9745fe Michal Kubecek    2019-12-27  314  		if (!strset_include(req_info, data, i) ||
71921690f9745fe Michal Kubecek    2019-12-27  315  		    !data->sets[i].per_dev)
71921690f9745fe Michal Kubecek    2019-12-27  316  			continue;
71921690f9745fe Michal Kubecek    2019-12-27  317  
a0400b1b08fea15 Maxime Chevallier 2024-07-01  318  		ret = strset_prepare_set(&data->sets[i], dev, phydev, i,
71921690f9745fe Michal Kubecek    2019-12-27  319  					 req_info->counts_only);
71921690f9745fe Michal Kubecek    2019-12-27  320  		if (ret < 0)
71921690f9745fe Michal Kubecek    2019-12-27  321  			goto err_ops;
71921690f9745fe Michal Kubecek    2019-12-27  322  	}
71921690f9745fe Michal Kubecek    2019-12-27  323  	ethnl_ops_complete(dev);
71921690f9745fe Michal Kubecek    2019-12-27  324  
71921690f9745fe Michal Kubecek    2019-12-27  325  	return 0;
71921690f9745fe Michal Kubecek    2019-12-27  326  err_ops:
71921690f9745fe Michal Kubecek    2019-12-27  327  	ethnl_ops_complete(dev);
71921690f9745fe Michal Kubecek    2019-12-27  328  err_strset:
71921690f9745fe Michal Kubecek    2019-12-27  329  	strset_cleanup_data(reply_base);
71921690f9745fe Michal Kubecek    2019-12-27  330  	return ret;
71921690f9745fe Michal Kubecek    2019-12-27  331  }
71921690f9745fe Michal Kubecek    2019-12-27  332  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki