]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/mlx5: Fix bit-wise and with zero
authorColin Ian King <colin.king@canonical.com>
Tue, 6 Apr 2021 16:53:46 +0000 (17:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:50:11 +0000 (10:50 +0200)
[ Upstream commit 82c3ba31c370b6001cbf90689e98da1fb6f26aef ]

The bit-wise and of the action field with MLX5_ACCEL_ESP_ACTION_DECRYPT
is incorrect as MLX5_ACCEL_ESP_ACTION_DECRYPT is zero and not intended
to be a bit-flag. Fix this by using the == operator as was originally
intended.

Addresses-Coverity: ("Logically dead code")
Fixes: 7dfee4b1d79e ("net/mlx5: IPsec, Refactor SA handle creation and destruction")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c

index 22bee49902327dae0ec807e49a0f755557f20e2c..bb61f52d782d99e261dacf0d953b28d1c4adc3f8 100644 (file)
@@ -850,7 +850,7 @@ mlx5_fpga_ipsec_release_sa_ctx(struct mlx5_fpga_ipsec_sa_ctx *sa_ctx)
                return;
        }
 
-       if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action &
+       if (sa_ctx->fpga_xfrm->accel_xfrm.attrs.action ==
            MLX5_ACCEL_ESP_ACTION_DECRYPT)
                ida_simple_remove(&fipsec->halloc, sa_ctx->sa_handle);