Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Amit Cohen <amcohen@nvidia.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Petr Machata <petrm@nvidia.com>, Ido Schimmel <idosch@nvidia.com>
Subject: [jpirko-mlxsw:combined_queue 24/35] drivers/net/ethernet/mellanox/mlxsw/core.c:2951:7: warning: variable 'local_port' is uninitialized when used here
Date: Sat, 14 Sep 2024 21:36:53 +0800	[thread overview]
Message-ID: <202409142143.HwnD7F8g-lkp@intel.com> (raw)

tree:   https://github.com/jpirko/linux_mlxsw combined_queue
head:   a0a3d1125af568d8cc9181967c8a0cd7212810a2
commit: 9a36de81e7b29b3b0146a7998986149559842a2d [24/35] mlxsw: Check Rx local port in PCI code
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240914/202409142143.HwnD7F8g-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240914/202409142143.HwnD7F8g-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/202409142143.HwnD7F8g-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/mellanox/mlxsw/core.c:2951:7: warning: variable 'local_port' is uninitialized when used here [-Wuninitialized]
    2951 |             (local_port >= mlxsw_core->max_ports))
         |              ^~~~~~~~~~
   drivers/net/ethernet/mellanox/mlxsw/core.c:2947:16: note: initialize the variable 'local_port' to silence this warning
    2947 |         u16 local_port;
         |                       ^
         |                        = 0
   1 warning generated.


vim +/local_port +2951 drivers/net/ethernet/mellanox/mlxsw/core.c

4ec14b7634b298 Ido Schimmel 2015-07-29  2941  
93c1edb27f9e7e Jiri Pirko   2015-07-29  2942  void mlxsw_core_skb_receive(struct mlxsw_core *mlxsw_core, struct sk_buff *skb,
93c1edb27f9e7e Jiri Pirko   2015-07-29  2943  			    struct mlxsw_rx_info *rx_info)
93c1edb27f9e7e Jiri Pirko   2015-07-29  2944  {
93c1edb27f9e7e Jiri Pirko   2015-07-29  2945  	struct mlxsw_rx_listener_item *rxl_item;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2946  	const struct mlxsw_rx_listener *rxl;
c934757d90000a Amit Cohen   2021-12-01  2947  	u16 local_port;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2948  	bool found = false;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2949  
93c1edb27f9e7e Jiri Pirko   2015-07-29  2950  	if ((rx_info->trap_id >= MLXSW_TRAP_ID_MAX) ||
5ec2ee7dd26452 Ido Schimmel 2017-03-24 @2951  	    (local_port >= mlxsw_core->max_ports))
93c1edb27f9e7e Jiri Pirko   2015-07-29  2952  		goto drop;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2953  
93c1edb27f9e7e Jiri Pirko   2015-07-29  2954  	rcu_read_lock();
93c1edb27f9e7e Jiri Pirko   2015-07-29  2955  	list_for_each_entry_rcu(rxl_item, &mlxsw_core->rx_listener_list, list) {
93c1edb27f9e7e Jiri Pirko   2015-07-29  2956  		rxl = &rxl_item->rxl;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2957  		if ((rxl->local_port == MLXSW_PORT_DONT_CARE ||
9a36de81e7b29b Amit Cohen   2024-09-11  2958  		     rxl->local_port == rx_info->local_port) &&
6a8c101e0795d4 Ido Schimmel 2020-07-14  2959  		    rxl->trap_id == rx_info->trap_id &&
6a8c101e0795d4 Ido Schimmel 2020-07-14  2960  		    rxl->mirror_reason == rx_info->mirror_reason) {
c83da2929fcd1f Jiri Pirko   2020-02-24  2961  			if (rxl_item->enabled)
93c1edb27f9e7e Jiri Pirko   2015-07-29  2962  				found = true;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2963  			break;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2964  		}
93c1edb27f9e7e Jiri Pirko   2015-07-29  2965  	}
7d8e8f3433dc8d Ido Schimmel 2020-07-29  2966  	if (!found) {
93c1edb27f9e7e Jiri Pirko   2015-07-29  2967  		rcu_read_unlock();
93c1edb27f9e7e Jiri Pirko   2015-07-29  2968  		goto drop;
7d8e8f3433dc8d Ido Schimmel 2020-07-29  2969  	}
93c1edb27f9e7e Jiri Pirko   2015-07-29  2970  
9a36de81e7b29b Amit Cohen   2024-09-11  2971  	rxl->func(skb, rx_info->local_port, rxl_item->priv);
7d8e8f3433dc8d Ido Schimmel 2020-07-29  2972  	rcu_read_unlock();
93c1edb27f9e7e Jiri Pirko   2015-07-29  2973  	return;
93c1edb27f9e7e Jiri Pirko   2015-07-29  2974  
93c1edb27f9e7e Jiri Pirko   2015-07-29  2975  drop:
93c1edb27f9e7e Jiri Pirko   2015-07-29  2976  	dev_kfree_skb(skb);
93c1edb27f9e7e Jiri Pirko   2015-07-29  2977  }
93c1edb27f9e7e Jiri Pirko   2015-07-29  2978  EXPORT_SYMBOL(mlxsw_core_skb_receive);
93c1edb27f9e7e Jiri Pirko   2015-07-29  2979  

:::::: The code at line 2951 was first introduced by commit
:::::: 5ec2ee7dd26452c2852b395b323b0260c27c2e25 mlxsw: Query maximum number of ports from firmware

:::::: TO: Ido Schimmel <idosch@mellanox.com>
:::::: CC: David S. Miller <davem@davemloft.net>

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

                 reply	other threads:[~2024-09-14 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202409142143.HwnD7F8g-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=amcohen@nvidia.com \
    --cc=idosch@nvidia.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=petrm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox