mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH-next] RDMA/erdma: Fix opcode conditional check
@ 2024-12-19  4:39 Advait Dhamorikar
  2024-12-19  5:40 ` Cheng Xu
  2024-12-19 12:16 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Advait Dhamorikar @ 2024-12-19  4:39 UTC (permalink / raw)
  To: Cheng Xu, Kai Shen, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel, Advait Dhamorikar

Fix conditional if else check by checking with wr->opcode.
The indicated dead code may have performed some action; that
action will never occur as op is pre-assigned a different value.

Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
 drivers/infiniband/hw/erdma/erdma_qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/erdma/erdma_qp.c b/drivers/infiniband/hw/erdma/erdma_qp.c
index 4dfb4272ad86..5c266918fb36 100644
--- a/drivers/infiniband/hw/erdma/erdma_qp.c
+++ b/drivers/infiniband/hw/erdma/erdma_qp.c
@@ -406,7 +406,7 @@ static void init_send_sqe_rc(struct erdma_qp *qp, struct erdma_send_sqe_rc *sqe,
 	if (wr->opcode == IB_WR_SEND_WITH_IMM) {
 		op = ERDMA_OP_SEND_WITH_IMM;
 		sqe->imm_data = wr->ex.imm_data;
-	} else if (op == IB_WR_SEND_WITH_INV) {
+	} else if (wr->opcode == IB_WR_SEND_WITH_INV) {
 		op = ERDMA_OP_SEND_WITH_INV;
 		sqe->invalid_stag = cpu_to_le32(wr->ex.invalidate_rkey);
 	}
-- 
2.34.1


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

* Re: [PATCH-next] RDMA/erdma: Fix opcode conditional check
  2024-12-19  4:39 [PATCH-next] RDMA/erdma: Fix opcode conditional check Advait Dhamorikar
@ 2024-12-19  5:40 ` Cheng Xu
  2024-12-19 12:16 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Cheng Xu @ 2024-12-19  5:40 UTC (permalink / raw)
  To: Advait Dhamorikar, Kai Shen, Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, linux-kernel



On 12/19/24 12:39 PM, Advait Dhamorikar wrote:
> Fix conditional if else check by checking with wr->opcode.
> The indicated dead code may have performed some action; that
> action will never occur as op is pre-assigned a different value.
> 
> Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
> ---
>  drivers/infiniband/hw/erdma/erdma_qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Cheng Xu <chengyou@linux.alibaba.com>

Thanks very much,
Cheng Xu

> diff --git a/drivers/infiniband/hw/erdma/erdma_qp.c b/drivers/infiniband/hw/erdma/erdma_qp.c
> index 4dfb4272ad86..5c266918fb36 100644
> --- a/drivers/infiniband/hw/erdma/erdma_qp.c
> +++ b/drivers/infiniband/hw/erdma/erdma_qp.c
> @@ -406,7 +406,7 @@ static void init_send_sqe_rc(struct erdma_qp *qp, struct erdma_send_sqe_rc *sqe,
>  	if (wr->opcode == IB_WR_SEND_WITH_IMM) {
>  		op = ERDMA_OP_SEND_WITH_IMM;
>  		sqe->imm_data = wr->ex.imm_data;
> -	} else if (op == IB_WR_SEND_WITH_INV) {
> +	} else if (wr->opcode == IB_WR_SEND_WITH_INV) {
>  		op = ERDMA_OP_SEND_WITH_INV;
>  		sqe->invalid_stag = cpu_to_le32(wr->ex.invalidate_rkey);
>  	}

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

* Re: [PATCH-next] RDMA/erdma: Fix opcode conditional check
  2024-12-19  4:39 [PATCH-next] RDMA/erdma: Fix opcode conditional check Advait Dhamorikar
  2024-12-19  5:40 ` Cheng Xu
@ 2024-12-19 12:16 ` Leon Romanovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2024-12-19 12:16 UTC (permalink / raw)
  To: Cheng Xu, Kai Shen, Jason Gunthorpe, Advait Dhamorikar
  Cc: linux-rdma, linux-kernel


On Thu, 19 Dec 2024 10:09:39 +0530, Advait Dhamorikar wrote:
> Fix conditional if else check by checking with wr->opcode.
> The indicated dead code may have performed some action; that
> action will never occur as op is pre-assigned a different value.
> 
> 

Applied, thanks!

[1/1] RDMA/erdma: Fix opcode conditional check
      https://git.kernel.org/rdma/rdma/c/c57c76498a895a

Best regards,
-- 
Leon Romanovsky <leon@kernel.org>


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

end of thread, other threads:[~2024-12-19 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-19  4:39 [PATCH-next] RDMA/erdma: Fix opcode conditional check Advait Dhamorikar
2024-12-19  5:40 ` Cheng Xu
2024-12-19 12:16 ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®