net/mlx5e: Fix uninitialized variable
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 31 Jul 2018 14:21:57 +0000 (09:21 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Aug 2018 16:38:05 +0000 (09:38 -0700)
There is a potential execution path in which variable *err* is returned
without being properly initialized previously.

Fix this by initializing variable *err* to 0.

Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index fde3502..de2827a 100644 (file)
@@ -4215,7 +4215,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
        struct mlx5e_priv *priv = netdev_priv(netdev);
        struct bpf_prog *old_prog;
        bool reset, was_opened;
-       int err;
+       int err = 0;
        int i;
 
        mutex_lock(&priv->state_lock);