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: <202208241159.MBTFc7zj-lkp@intel.com>
Date:   Wed, 24 Aug 2022 11:17:52 +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_for_vladimir4 36/48]
 drivers/net/ethernet/mellanox/mlxsw/minimal.c:241:45: warning: variable
 'mlxsw_m_port' is uninitialized when used here

tree:   https://github.com/jpirko/linux_mlxsw jiri_devel_for_vladimir4
head:   0748b27ec2fd62b4d095c005d378957972b267ed
commit: ecb7a921e77345662154db3823c1eee8204102a5 [36/48] net: make drivers to use SET_NETDEV_DEVLINK_PORT to set devlink_port
config: s390-randconfig-r014-20220823 (https://download.01.org/0day-ci/archive/20220824/202208241159.MBTFc7zj-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project d00e97df0fe8c67f694c4d027297f4382ce72b38)
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
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/jpirko/linux_mlxsw/commit/ecb7a921e77345662154db3823c1eee8204102a5
        git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
        git fetch --no-tags jpirko-mlxsw jiri_devel_for_vladimir4
        git checkout ecb7a921e77345662154db3823c1eee8204102a5
        # 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=s390 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 >>):

   In file included from drivers/net/ethernet/mellanox/mlxsw/minimal.c:4:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from drivers/net/ethernet/mellanox/mlxsw/minimal.c:4:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from drivers/net/ethernet/mellanox/mlxsw/minimal.c:4:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> drivers/net/ethernet/mellanox/mlxsw/minimal.c:241: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:222:35: note: initialize the variable 'mlxsw_m_port' to silence this warning
           struct mlxsw_m_port *mlxsw_m_port;
                                            ^
                                             = NULL
   13 warnings generated.


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

   218	
   219	static int
   220	mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u16 local_port, u8 module)
   221	{
   222		struct mlxsw_m_port *mlxsw_m_port;
   223		struct net_device *dev;
   224		int err;
   225	
   226		err = mlxsw_core_port_init(mlxsw_m->core, local_port, 0,
   227					   module + 1, false, 0, false,
   228					   0, mlxsw_m->base_mac,
   229					   sizeof(mlxsw_m->base_mac));
   230		if (err) {
   231			dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to init core port\n",
   232				local_port);
   233			return err;
   234		}
   235	
   236		dev = alloc_etherdev(sizeof(struct mlxsw_m_port));
   237		if (!dev) {
   238			err = -ENOMEM;
   239			goto err_alloc_etherdev;
   240		}
 > 241		mlxsw_core_port_netdev_link(mlxsw_m->core, mlxsw_m_port->local_port,
   242					    mlxsw_m_port, dev);
   243		SET_NETDEV_DEV(dev, mlxsw_m->bus_info->dev);
   244		dev_net_set(dev, mlxsw_core_net(mlxsw_m->core));
   245		mlxsw_m_port = netdev_priv(dev);
   246		mlxsw_m_port->dev = dev;
   247		mlxsw_m_port->mlxsw_m = mlxsw_m;
   248		mlxsw_m_port->local_port = local_port;
   249		mlxsw_m_port->module = module;
   250	
   251		dev->netdev_ops = &mlxsw_m_port_netdev_ops;
   252		dev->ethtool_ops = &mlxsw_m_port_ethtool_ops;
   253	
   254		err = mlxsw_m_port_dev_addr_get(mlxsw_m_port);
   255		if (err) {
   256			dev_err(mlxsw_m->bus_info->dev, "Port %d: Unable to get port mac address\n",
   257				mlxsw_m_port->local_port);
   258			goto err_dev_addr_get;
   259		}
   260	
   261		netif_carrier_off(dev);
   262		mlxsw_m->ports[local_port] = mlxsw_m_port;
   263		err = register_netdev(dev);
   264		if (err) {
   265			dev_err(mlxsw_m->bus_info->dev, "Port %d: Failed to register netdev\n",
   266				mlxsw_m_port->local_port);
   267			goto err_register_netdev;
   268		}
   269	
   270		return 0;
   271	
   272	err_register_netdev:
   273		mlxsw_m->ports[local_port] = NULL;
   274	err_dev_addr_get:
   275		free_netdev(dev);
   276	err_alloc_etherdev:
   277		mlxsw_core_port_fini(mlxsw_m->core, local_port);
   278		return err;
   279	}
   280	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ