Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
To: chengyou@linux.alibaba.com, kaishen@linux.alibaba.com
Cc: jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Clarification on dead code in init_send_sqe_rc Function
Date: Thu, 19 Dec 2024 09:50:28 +0530	[thread overview]
Message-ID: <Z2OfDPDPbpclUoaa@HOME-PC> (raw)

Dear Maintainers,

While analyzing the init_send_sqe_rc function in the erdma driver, specifically
in the erdma_qp.c file, I noticed a static analysis issue flagged by Coverity
(CID 1602610) regarding a dead code block.

Link to Coverity issue:
https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602610

In the function, the variable op is initialized to ERDMA_OP_SEND as follows:

--> u32 op = ERDMA_OP_SEND;

The conditional block shown below is unreachable because op is never assigned
 the value IB_WR_SEND_WITH_INV after its initialization. The condition will
 always evaluate to false, rendering this block of code dead.

--> } else if (op == IB_WR_SEND_WITH_INV) {
-->     op = ERDMA_OP_SEND_WITH_INV;
-->     sqe->invalid_stag = cpu_to_le32(wr->ex.invalidate_rkey);
--> }

I wanted to ask for clarification regarding the intended behavior:

	1. Should there be an additional condition in wr->opcode to set op to
	   IB_WR_SEND_WITH_INV before this block is checked?
	2. If this block is unnecessary, should it be removed to clean up the
	   code?

If the logic requires changes, I would be happy to submit a patch to address
this issue. Please let me know your thoughts on how best to proceed.

Thank you for your time.

-Dheeraj

                 reply	other threads:[~2024-12-19  4:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z2OfDPDPbpclUoaa@HOME-PC \
    --to=dheeraj.linuxdev@gmail.com \
    --cc=chengyou@linux.alibaba.com \
    --cc=jgg@ziepe.ca \
    --cc=kaishen@linux.alibaba.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox