diff mbox series

[net-next,1/1] net/mlx5e: Fix returning uninitialized err

Message ID 20220830122024.2900197-1-roid@nvidia.com (mailing list archive)
State Accepted
Commit 92f97c00f0ca538fe820c0b18b6f957a69410689
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/1] net/mlx5e: Fix returning uninitialized err | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: mbloch@nvidia.com; 6 maintainers not CCed: edumazet@google.com pabeni@redhat.com leon@kernel.org mbloch@nvidia.com linux-rdma@vger.kernel.org kuba@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Roi Dayan Aug. 30, 2022, 12:20 p.m. UTC
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")
Reported-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Roi Dayan Aug. 31, 2022, 5:40 a.m. UTC | #1
On 2022-08-30 3:20 PM, Roi Dayan 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")
> Reported-by: Alexander Lobakin <alexandr.lobakin@intel.com>
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> Reviewed-by: Maor Dickman <maord@nvidia.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> index 914bddbfc1d7..e09bca78df75 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> @@ -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

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()
Jakub Kicinski Aug. 31, 2022, 6:15 a.m. UTC | #2
On Wed, 31 Aug 2022 08:40:28 +0300 Roi Dayan wrote:
> On 2022-08-30 3:20 PM, Roi Dayan 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")
> > Reported-by: Alexander Lobakin <alexandr.lobakin@intel.com>
> > Signed-off-by: Roi Dayan <roid@nvidia.com>
> > Reviewed-by: Maor Dickman <maord@nvidia.com>
> > ---
> >   drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 +++-------
> >   1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > index 914bddbfc1d7..e09bca78df75 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
> > @@ -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  
> 
> 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..
patchwork-bot+netdevbpf@kernel.org Aug. 31, 2022, 6:30 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Reported-by: Alexander Lobakin <alexandr.lobakin@intel.com>
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> Reviewed-by: Maor Dickman <maord@nvidia.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 914bddbfc1d7..e09bca78df75 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -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