Skip to contentSkip to conversation

net/mlx5e: Fix uninitialized variable

PATCH Applied Gustavo A. R. Silva 4 participants 5 messages Jul 31, 2018 – Aug 1, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5e: Fix uninitialized variable

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")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
index fde3502..de2827a 100644
@@ -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);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Gustavo A. R. Silva

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")
---
  drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -0
index fde3502..de2827a 100644

drivers/net/ethernet/mellanox/mlx5/core/en_main.c static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) · line 4221

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -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);

Thanks.

Acked-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 8 lines · Gustavo A. R. Silva

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")
maintainer Applied
#3 lore raw
In reply to Gustavo A. R. Silva

From: "Gustavo A. R. Silva" <[email protected]>
Date: Tue, 31 Jul 2018 09:21:57 -0500

Quoted 8 lines

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")

Applied to net-next.

#4 lore raw
Quoted 6 lines · David Miller

From: "Gustavo A. R. Silva" <[email protected]>
Date: Tue, 31 Jul 2018 09:21:57 -0500

Quoted 3 lines

There is a potential execution path in which variable *err* is returned without being properly initialized previously.

Quoted 8 lines
Quoted 5 lines

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")

Applied to net-next.

David,

Sorry I failed to tag this patch for net-next. I got a bit confused, once based on the logs, the usual committer for this driver is Saeed Mahameed; not you. So, I wasn't quite sure about how to proceed.

Thanks