diff mbox series

[net-next] net/mlx5e: Uninitialized variable in mlx5e_attach_decap()

Message ID 20200528124803.GC1219412@mwanda (mailing list archive)
State Not Applicable
Delegated to: Jason Gunthorpe
Headers show
Series [net-next] net/mlx5e: Uninitialized variable in mlx5e_attach_decap() | expand

Commit Message

Dan Carpenter May 28, 2020, 12:48 p.m. UTC
The "ret" variable isn't initialized on the success path.

There is an uninitentional behavior in current releases of GCC where
instead of warning about the uninitialized variable, it instead
initializes it to zero.  So that means that this bug likely doesn't
affect testing.

Fixes: 14e6b038afa0 ("net/mlx5e: Add support for hw decapsulation of MPLS over UDP")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Saeed Mahameed May 28, 2020, 8:56 p.m. UTC | #1
On Thu, 2020-05-28 at 15:48 +0300, Dan Carpenter wrote:
> The "ret" variable isn't initialized on the success path.
> 
> There is an uninitentional behavior in current releases of GCC where
> instead of warning about the uninitialized variable, it instead
> initializes it to zero.  So that means that this bug likely doesn't
> affect testing.
> 
> Fixes: 14e6b038afa0 ("net/mlx5e: Add support for hw decapsulation of
> MPLS over UDP")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Hi Dan,

thanks for the fix,  a similar fix was already submitted yesterday and
i already pulled it into my tree, I will send a pull request to net-
next soon.

Thanks,
Saeed.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 571da14809fec..ae53bf5994215 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -3637,7 +3637,7 @@  static int mlx5e_attach_decap(struct mlx5e_priv *priv,
 	struct mlx5e_decap_entry *d;
 	struct mlx5e_decap_key key;
 	uintptr_t hash_key;
-	int err;
+	int err = 0;
 
 	parse_attr = attr->parse_attr;
 	if (sizeof(parse_attr->eth) > MLX5_CAP_ESW(priv->mdev, max_encap_header_size)) {