All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] net/mlx5: Fix bit-wise and with zero
@ 2021-04-06 16:53 Colin King
  2021-04-06 21:13 ` Laurence Oberman
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-04-06 16:53 UTC (permalink / raw)
  To: Boris Pismenny, Saeed Mahameed, Leon Romanovsky,
	David S . Miller, Jakub Kicinski, Raed Salem, Huy Nguyen, netdev,
	linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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>
---
 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
index d43a05e77f67..0b19293cdd74 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
@@ -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_free(&fipsec->halloc, sa_ctx->sa_handle);
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] net/mlx5: Fix bit-wise and with zero
  2021-04-06 16:53 [PATCH][next] net/mlx5: Fix bit-wise and with zero Colin King
@ 2021-04-06 21:13 ` Laurence Oberman
  0 siblings, 0 replies; 2+ messages in thread
From: Laurence Oberman @ 2021-04-06 21:13 UTC (permalink / raw)
  To: Colin King, Boris Pismenny, Saeed Mahameed, Leon Romanovsky,
	David S . Miller, Jakub Kicinski, Raed Salem, Huy Nguyen, netdev,
	linux-rdma
  Cc: kernel-janitors, linux-kernel

On Tue, 2021-04-06 at 17:53 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> index d43a05e77f67..0b19293cdd74 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
> @@ -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_free(&fipsec->halloc, sa_ctx->sa_handle);
>  

Looks correct to me with enum mlx5_accel_esp_action action;

Reviewed-by Laurence Oberman <loberman@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-06 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 16:53 [PATCH][next] net/mlx5: Fix bit-wise and with zero Colin King
2021-04-06 21:13 ` Laurence Oberman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.