Re: [linux-next:master 2144/2798] drivers/net/ethernet/marvell/prestera/prestera_switchdev.c:1049:11: warning: variable 'vid' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jan 16, 2021 at 2:28 PM Souptick Joarder <jrdr.linux@xxxxxxxxx> wrote:
>
> On Thu, Jan 14, 2021 at 9:54 AM kernel test robot <lkp@xxxxxxxxx> wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head:   aa515cdce7a151dcc14b7600d33f1414c6fa32c9
> > commit: b7a9e0da2d1c954b7c38217a29e002528b90d174 [2144/2798] net: switchdev: remove vid_begin -> vid_end range from VLAN objects
> > config: x86_64-randconfig-a004-20210114 (attached as .config)
> > compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 6077d55381a6aa3e947ef7abdc36a7515c598c8a)
> > 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 x86_64 cross compiling tool for clang build
> >         # apt-get install binutils-x86-64-linux-gnu
> >         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=b7a9e0da2d1c954b7c38217a29e002528b90d174
> >         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> >         git fetch --no-tags linux-next master
> >         git checkout b7a9e0da2d1c954b7c38217a29e002528b90d174
> >         # save the attached .config to linux build tree
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> drivers/net/ethernet/marvell/prestera/prestera_switchdev.c:1049:11: warning: variable 'vid' is uninitialized when used here [-Wuninitialized]
> >                                                 vid, flag_untagged,
> >                                                 ^~~
> >    drivers/net/ethernet/marvell/prestera/prestera_switchdev.c:1032:9: note: initialize the variable 'vid' to silence this warning
> >            u16 vid;
> >                   ^
> >                    = 0
> >    1 warning generated.
> >
> >
> > vim +/vid +1049 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
> >
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1020
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1021  static int prestera_port_vlans_add(struct prestera_port *port,
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1022                                  const struct switchdev_obj_port_vlan *vlan,
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1023                                  struct switchdev_trans *trans,
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1024                                  struct netlink_ext_ack *extack)
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1025  {
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1026       bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1027       bool flag_pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1028       struct net_device *dev = vlan->obj.orig_dev;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1029       struct prestera_bridge_port *br_port;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1030       struct prestera_switch *sw = port->sw;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1031       struct prestera_bridge *bridge;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1032       u16 vid;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1033
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1034       if (netif_is_bridge_master(dev))
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1035               return 0;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1036
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1037       if (switchdev_trans_ph_commit(trans))
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1038               return 0;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1039
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1040       br_port = prestera_bridge_port_by_dev(sw->swdev, dev);
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1041       if (WARN_ON(!br_port))
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1042               return -EINVAL;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1043
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1044       bridge = br_port->bridge;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1045       if (!bridge->vlan_enabled)
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1046               return 0;
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1047
> > b7a9e0da2d1c954b Vladimir Oltean 2021-01-09  1048       return prestera_bridge_port_vlan_add(port, br_port,
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16 @1049                                            vid, flag_untagged,
>
> Currently vid is passed as garbage value. Is initializing vid = 0 and
> passing it to prestera_bridge_port_vlan_add()
> the right thing to do ? Or do we need to pass more appropriate values ?

Please ignore this comment. Vladimir has already posted the fix.
>
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1050                                            flag_pvid, extack);
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1051  }
> > e1189d9a5fbec815 Vadym Kochan    2020-09-16  1052
> >
> > :::::: The code at line 1049 was first introduced by commit
> > :::::: e1189d9a5fbec8153dbe03f3589bc2baa96694e2 net: marvell: prestera: Add Switchdev driver implementation
> >
> > :::::: TO: Vadym Kochan <vadym.kochan@xxxxxxxxxxx>
> > :::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux