Skip to contentSkip to conversation

net/mlx5e: Fix returning uninitialized err

PATCH Applied Roi Dayan 3 participants 4 messages Aug 30, 2022 – Aug 31, 2022

Subsystems (4)
lore
Share & tools
lore

Roi Dayan

author
#0 lore raw

PATCH 1/1 net/mlx5e: Fix returning uninitialized err

In the cited commit the function mlx5e_rep_add_meta_tunnel_rule() was added and in success flow, err was returned uninitialized. Fix it.

Fixes 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -7
index 914bddbfc1d7..e09bca78df75 100644
@@ -471,22 +471,18 @@ mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv)
 	struct mlx5_eswitch_rep *rep = rpriv->rep;
 	struct mlx5_flow_handle *flow_rule;
 	struct mlx5_flow_group *g;
-	int err;
 
 	g = esw->fdb_table.offloads.send_to_vport_meta_grp;
 	if (!g)
 		return 0;
 
 	flow_rule = mlx5_eswitch_add_send_to_vport_meta_rule(esw, rep->vport);
-	if (IS_ERR(flow_rule)) {
-		err = PTR_ERR(flow_rule);
-		goto out;
-	}
+	if (IS_ERR(flow_rule))
+		return PTR_ERR(flow_rule);
 
 	rpriv->send_to_vport_meta_rule = flow_rule;
 
-out:
-	return err;
+	return 0;
 }
 
 static void
Signature · 1 line
2.34.3
author
#1 lore raw
Quoted 32 lines · Roi Dayan

In the cited commit the function mlx5e_rep_add_meta_tunnel_rule() was added and in success flow, err was returned uninitialized. Fix it.

Fixes 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation")
---
  drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +1 -5
index 914bddbfc1d7..e09bca78df75 100644
@@ -471,22 +471,18 @@ mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv)
  	struct mlx5_eswitch_rep *rep = rpriv->rep;
  	struct mlx5_flow_handle *flow_rule;
  	struct mlx5_flow_group *g;
-	int err;
 
  	g = esw->fdb_table.offloads.send_to_vport_meta_grp;
  	if (!g)
  		return 0;
 
  	flow_rule = mlx5_eswitch_add_send_to_vport_meta_rule(esw, rep->vport);
-	if (IS_ERR(flow_rule)) {
-		err = PTR_ERR(flow_rule);
-		goto out;
-	}
+	if (IS_ERR(flow_rule))

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv) · line 488

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -2
+		return PTR_ERR(flow_rule);
 
  	rpriv->send_to_vport_meta_rule = flow_rule;
 
-out:
-	return err;
+	return 0;
  }
 
  static void

just noticed same patch from Nathan Chancellor.
so can ignore this one.

[PATCH net-next] net/mlx5e: Do not use err uninitialized in mlx5e_rep_add_meta_tunnel_rule()

maintainer
#2 lore raw
Quoted 42 lines · On Wed, 31 Aug 2022 08:40:28 +0300 Roi Dayan wrote:
Quoted 41 lines · Roi Dayan

In the cited commit the function mlx5e_rep_add_meta_tunnel_rule() was added and in success flow, err was returned uninitialized. Fix it.

Fixes 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation")
---
  drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -7
index 914bddbfc1d7..e09bca78df75 100644
@@ -471,22 +471,18 @@ mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv)
  	struct mlx5_eswitch_rep *rep = rpriv->rep;
  	struct mlx5_flow_handle *flow_rule;
  	struct mlx5_flow_group *g;
-	int err;
 
  	g = esw->fdb_table.offloads.send_to_vport_meta_grp;
  	if (!g)
  		return 0;
 
  	flow_rule = mlx5_eswitch_add_send_to_vport_meta_rule(esw, rep->vport);
-	if (IS_ERR(flow_rule)) {
-		err = PTR_ERR(flow_rule);
-		goto out;
-	}
+	if (IS_ERR(flow_rule))
+		return PTR_ERR(flow_rule);
 
  	rpriv->send_to_vport_meta_rule = flow_rule;
 
-out:
-	return err;
+	return 0;
  }
 
Quoted 7 lines

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c mlx5e_rep_add_meta_tunnel_rule(struct mlx5e_priv *priv) · line 488

Quoted 1 line
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 -0
  static void  

just noticed same patch from Nathan Chancellor.
so can ignore this one.

[PATCH net-next] net/mlx5e: Do not use err uninitialized in mlx5e_rep_add_meta_tunnel_rule()

Oh, I thought Saeed will take Nathan's patch thru his tree but since there was no reply let me take it directly..

#3 lore raw
In reply to Roi Dayan
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Tue, 30 Aug 2022 15:20:24 +0300 you wrote:

In the cited commit the function mlx5e_rep_add_meta_tunnel_rule() was added and in success flow, err was returned uninitialized. Fix it.

Fixes 430e2d5e2a98 ("net/mlx5: E-Switch, Move send to vport meta rule creation")

[...]

Here is the summary with links:
- [net-next,1/1] net/mlx5e: Fix returning uninitialized err

    https://git.kernel.org/netdev/net-next/c/92f97c00f0ca

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html