iscsi-scst: Suppress a Coverity taint complaint

Suppress the following (false positive) Coverity complaint:

    CID 271578 (#1 of 1): Dereference after null check (FORWARD_NULL)
    var_deref_model: Passing null pointer (*ref_cmd).scst_cmd to
    scst_set_delivery_status, which dereferences it

(*ref_cmd).scst_aen is set when (*ref_cmd).scst_state == ISCSI_CMD_STATE_AEN
and vice versa, so the Coverity complaint is a false positive. Hence rewrite
the code to suppress this complaint and make the code cleaner.
This commit is contained in:
Gleb Chesnokov
2022-06-27 14:14:52 +03:00
parent 828940842a
commit 33861d0a6d
+12 -8
View File
@@ -1315,15 +1315,19 @@ out_err:
(unsigned long long)conn->session->sid,
conn->cid, conn->write_cmnd);
}
if (ref_cmd_to_parent &&
((ref_cmd->scst_cmd != NULL) || (ref_cmd->scst_aen != NULL))) {
if (ref_cmd->scst_state == ISCSI_CMD_STATE_AEN)
scst_set_aen_delivery_status(ref_cmd->scst_aen,
SCST_AEN_RES_FAILED);
else
scst_set_delivery_status(ref_cmd->scst_cmd,
SCST_CMD_DELIVERY_FAILED);
if (ref_cmd_to_parent) {
if (ref_cmd->scst_state == ISCSI_CMD_STATE_AEN) {
if (ref_cmd->scst_aen)
scst_set_aen_delivery_status(ref_cmd->scst_aen,
SCST_AEN_RES_FAILED);
} else {
if (ref_cmd->scst_cmd)
scst_set_delivery_status(ref_cmd->scst_cmd,
SCST_CMD_DELIVERY_FAILED);
}
}
goto out;
}