staging: fsl-dpaa2/ethsw: Fix uninitialized variables
authorIoana Radulescu <ruxandra.radulescu@nxp.com>
Thu, 30 Aug 2018 13:17:08 +0000 (16:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Sep 2018 08:38:17 +0000 (10:38 +0200)
Functions port_vlans_add() and port_vlans_del() could,
in theory, return an uninitialized variable. Fix this
by initializing the variable in question at declaration.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-dpaa2/ethsw/ethsw.c

index 0066ca3072c131e74486233908de4583cf836a51..7a7ca67822c5fbad7fe476c126516dc896618055 100644 (file)
@@ -717,7 +717,7 @@ static int port_vlans_add(struct net_device *netdev,
                          struct switchdev_trans *trans)
 {
        struct ethsw_port_priv *port_priv = netdev_priv(netdev);
-       int vid, err;
+       int vid, err = 0;
 
        if (netif_is_bridge_master(vlan->obj.orig_dev))
                return -EOPNOTSUPP;
@@ -872,7 +872,7 @@ static int port_vlans_del(struct net_device *netdev,
                          const struct switchdev_obj_port_vlan *vlan)
 {
        struct ethsw_port_priv *port_priv = netdev_priv(netdev);
-       int vid, err;
+       int vid, err = 0;
 
        if (netif_is_bridge_master(vlan->obj.orig_dev))
                return -EOPNOTSUPP;