* [bug report] RDMA/hns: Avoid unncessary initialization
@ 2020-09-16 14:39 Dan Carpenter
2020-09-17 14:11 ` oulijun
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-16 14:39 UTC (permalink / raw)
To: oulijun; +Cc: linux-rdma
Hello Lijun Ou,
The patch a2f3d4479fe9: "RDMA/hns: Avoid unncessary initialization"
from Sep 8, 2020, leads to the following static checker warning:
drivers/infiniband/hw/hns/hns_roce_hw_v1.c:282 hns_roce_v1_post_send()
error: uninitialized symbol 'ps_opcode'.
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
256 switch (wr->opcode) {
257 case IB_WR_RDMA_READ:
258 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_READ;
259 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
260 rdma_wr(wr)->rkey);
261 break;
262 case IB_WR_RDMA_WRITE:
263 case IB_WR_RDMA_WRITE_WITH_IMM:
264 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_WRITE;
265 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
266 rdma_wr(wr)->rkey);
267 break;
268 case IB_WR_SEND:
269 case IB_WR_SEND_WITH_INV:
270 case IB_WR_SEND_WITH_IMM:
271 ps_opcode = HNS_ROCE_WQE_OPCODE_SEND;
272 break;
273 case IB_WR_LOCAL_INV:
^^^^^^^^^^^^^^^^^^^^
"ps_opcode" is not initialized for this case statement.
274 break;
275 case IB_WR_ATOMIC_CMP_AND_SWP:
276 case IB_WR_ATOMIC_FETCH_AND_ADD:
277 case IB_WR_LSO:
278 default:
279 ps_opcode = HNS_ROCE_WQE_OPCODE_MASK;
280 break;
281 }
282 ctrl->flag |= cpu_to_le32(ps_opcode);
^^^^^^^^^
Uninitialized.
283 wqe += sizeof(struct hns_roce_wqe_raddr_seg);
284
285 dseg = wqe;
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] RDMA/hns: Avoid unncessary initialization
2020-09-16 14:39 [bug report] RDMA/hns: Avoid unncessary initialization Dan Carpenter
@ 2020-09-17 14:11 ` oulijun
0 siblings, 0 replies; 2+ messages in thread
From: oulijun @ 2020-09-17 14:11 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-rdma
Thanks. I will fix it.
在 2020/9/16 22:39, Dan Carpenter 写道:
> Hello Lijun Ou,
>
> The patch a2f3d4479fe9: "RDMA/hns: Avoid unncessary initialization"
> from Sep 8, 2020, leads to the following static checker warning:
>
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c:282 hns_roce_v1_post_send()
> error: uninitialized symbol 'ps_opcode'.
>
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c
> 256 switch (wr->opcode) {
> 257 case IB_WR_RDMA_READ:
> 258 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_READ;
> 259 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
> 260 rdma_wr(wr)->rkey);
> 261 break;
> 262 case IB_WR_RDMA_WRITE:
> 263 case IB_WR_RDMA_WRITE_WITH_IMM:
> 264 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_WRITE;
> 265 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
> 266 rdma_wr(wr)->rkey);
> 267 break;
> 268 case IB_WR_SEND:
> 269 case IB_WR_SEND_WITH_INV:
> 270 case IB_WR_SEND_WITH_IMM:
> 271 ps_opcode = HNS_ROCE_WQE_OPCODE_SEND;
> 272 break;
> 273 case IB_WR_LOCAL_INV:
> ^^^^^^^^^^^^^^^^^^^^
> "ps_opcode" is not initialized for this case statement.
>
> 274 break;
> 275 case IB_WR_ATOMIC_CMP_AND_SWP:
> 276 case IB_WR_ATOMIC_FETCH_AND_ADD:
> 277 case IB_WR_LSO:
> 278 default:
> 279 ps_opcode = HNS_ROCE_WQE_OPCODE_MASK;
> 280 break;
> 281 }
> 282 ctrl->flag |= cpu_to_le32(ps_opcode);
> ^^^^^^^^^
> Uninitialized.
>
> 283 wqe += sizeof(struct hns_roce_wqe_raddr_seg);
> 284
> 285 dseg = wqe;
>
> regards,
> dan carpenter
> .
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-17 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16 14:39 [bug report] RDMA/hns: Avoid unncessary initialization Dan Carpenter
2020-09-17 14:11 ` oulijun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox