Skip to contentSkip to conversation

Clarification on dead code in init_send_sqe_rc Function

DISCUSSION Dheeraj Reddy Jonnalagadda 1 participant 1 message Dec 19, 2024 InfiniBand

lore
Share & tools
lore
#0 lore 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