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: <202210010623.aAcRNi6I-lkp@intel.com>
Date:   Sat, 1 Oct 2022 06:20:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jiri Pirko <jiri@...dia.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [jpirko-mlxsw:jiri_devel_devlink_locking 18/31]
 drivers/net/ethernet/mellanox/mlxsw/minimal.c:264:45: warning: variable
 'mlxsw_m_port' is uninitialized when used here

tree:   https://github.com/jpirko/linux_mlxsw jiri_devel_devlink_locking
head:   82dd9d9bf4d8b485dce34310d67a787f23a6b76b
commit: 1a58c89da3aa60a6d245f11d1bafa5217f4dfa28 [18/31] net: make drivers to use SET_NETDEV_DEVLINK_PORT to set devlink_port
config: i386-randconfig-c001
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/jpirko/linux_mlxsw/commit/1a58c89da3aa60a6d245f11d1bafa5217f4dfa28
        git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
        git fetch --no-tags jpirko-mlxsw jiri_devel_devlink_locking
        git checkout 1a58c89da3aa60a6d245f11d1bafa5217f4dfa28
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/mellanox/mlxsw/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/mellanox/mlxsw/minimal.c:264:45: warning: variable 'mlxsw_m_port' is uninitialized when used here [-Wuninitialized]
           mlxsw_core_port_netdev_link(mlxsw_m->core, mlxsw_m_port->local_port,
                                                      ^~~~~~~~~~~~
   drivers/net/ethernet/mellanox/mlxsw/minimal.c:245:35: note: initialize the variable 'mlxsw_m_port' to silence this warning
           struct mlxsw_m_port *mlxsw_m_port;
                                            ^
                                             = NULL
   1 warning generated.


vim +/mlxsw_m_port +264 drivers/net/ethernet/mellanox/mlxsw/minimal.c

   240	
   241	static int
   242	mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u16 local_port, u8 slot_index,
   243			    u8 module)
   244	{
   245		struct mlxsw_m_port *mlxsw_m_port;
   246		struct net_device *dev;
   247		int err;
   248	
   249		err = mlxsw_core_port_init(mlxsw_m->core, local_port, slot_index,
   250					   module + 1, false, 0, false,
   251					   0, mlxsw_m->base_mac,
   252					   sizeof(mlxsw_m->base_mac));
   253		if (err) {
   254			dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to init core port\n",
   255				local_port);
   256			return err;
   257		}
   258	
   259		dev = alloc_etherdev(sizeof(struct mlxsw_m_port));
   260		if (!dev) {
   261			err = -ENOMEM;
   262			goto err_alloc_etherdev;
   263		}
 > 264		mlxsw_core_port_netdev_link(mlxsw_m->core, mlxsw_m_port->local_port,
   265					    mlxsw_m_port, dev);
   266		SET_NETDEV_DEV(dev, mlxsw_m->bus_info->dev);
   267		dev_net_set(dev, mlxsw_core_net(mlxsw_m->core));
   268		mlxsw_m_port = netdev_priv(dev);
   269		mlxsw_m_port->dev = dev;
   270		mlxsw_m_port->mlxsw_m = mlxsw_m;
   271		mlxsw_m_port->local_port = local_port;
   272		mlxsw_m_port->module = module;
   273		mlxsw_m_port->slot_index = slot_index;
   274		/* Add module offset for line card. Offset for main board iz zero.
   275		 * For line card in slot #n offset is calculated as (#n - 1)
   276		 * multiplied by maximum modules number, which could be found on a line
   277		 * card.
   278		 */
   279		mlxsw_m_port->module_offset = mlxsw_m_port->slot_index ?
   280					      (mlxsw_m_port->slot_index - 1) *
   281					      mlxsw_m->max_modules_per_slot : 0;
   282	
   283		dev->netdev_ops = &mlxsw_m_port_netdev_ops;
   284		dev->ethtool_ops = &mlxsw_m_port_ethtool_ops;
   285	
   286		err = mlxsw_m_port_dev_addr_get(mlxsw_m_port);
   287		if (err) {
   288			dev_err(mlxsw_m->bus_info->dev, "Port %d: Unable to get port mac address\n",
   289				mlxsw_m_port->local_port);
   290			goto err_dev_addr_get;
   291		}
   292	
   293		netif_carrier_off(dev);
   294		mlxsw_m->ports[local_port] = mlxsw_m_port;
   295		err = register_netdev(dev);
   296		if (err) {
   297			dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to register netdev\n",
   298				mlxsw_m_port->local_port);
   299			goto err_register_netdev;
   300		}
   301	
   302		return 0;
   303	
   304	err_register_netdev:
   305		mlxsw_m->ports[local_port] = NULL;
   306	err_dev_addr_get:
   307		free_netdev(dev);
   308	err_alloc_etherdev:
   309		mlxsw_core_port_fini(mlxsw_m->core, local_port);
   310		return err;
   311	}
   312	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (132074 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ