mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 14:12:33 +00:00
isert-scst: Resolve the parent container after checking it exists
The saved Cppcheck report warns in isert_send_completion_handler: iscsi-scst/kernel/isert-scst/iser_rdma.c:429: warning: Either the condition 'iscsi_req_pdu' is redundant or there is overflow in pointer subtraction. [nullPointerArithmeticRedundantCheck] The parent request is optional, but container_of subtracts the member offset before the NULL check. Resolve the parent container only after confirming that the request exists and has a buffer. Preserve completion handling for responses without a parent and for valid remote tags.
This commit is contained in:
@@ -427,14 +427,16 @@ static void isert_send_completion_handler(struct isert_wr *wr)
|
||||
struct isert_cmnd *isert_pdu = wr->pdu;
|
||||
struct iscsi_cmnd *iscsi_pdu = &isert_pdu->iscsi;
|
||||
struct iscsi_cmnd *iscsi_req_pdu = iscsi_pdu->parent_req;
|
||||
struct isert_cmnd *isert_req_pdu = container_of(iscsi_req_pdu,
|
||||
struct isert_cmnd, iscsi);
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (iscsi_req_pdu && iscsi_req_pdu->bufflen &&
|
||||
isert_req_pdu->is_rstag_valid)
|
||||
isert_data_in_sent(iscsi_req_pdu);
|
||||
if (iscsi_req_pdu && iscsi_req_pdu->bufflen) {
|
||||
struct isert_cmnd *isert_req_pdu =
|
||||
container_of(iscsi_req_pdu, struct isert_cmnd, iscsi);
|
||||
|
||||
if (isert_req_pdu->is_rstag_valid)
|
||||
isert_data_in_sent(iscsi_req_pdu);
|
||||
}
|
||||
|
||||
isert_pdu_sent(iscsi_pdu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user