Skip to content

Commit

Permalink
scsi: qla2xxx: Avoid fcport pointer dereference
Browse files Browse the repository at this point in the history
Klocwork reported warning of NULL pointer may be dereferenced.  The routine
exits when sa_ctl is NULL and fcport is allocated after the exit call thus
causing NULL fcport pointer to dereference at the time of exit.

To avoid fcport pointer dereference, exit the routine when sa_ctl is NULL.

Cc: [email protected]
Signed-off-by: Nilesh Javali <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Himanshu Madhani <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
njavali authored and martinkpetersen committed Jun 15, 2023
1 parent 464ea49 commit 6b504d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/qla2xxx/qla_edif.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,8 +2361,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
if (!sa_ctl) {
ql_dbg(ql_dbg_edif, vha, 0x70e6,
"sa_ctl allocation failed\n");
rval = -ENOMEM;
goto done;
rval = -ENOMEM;
return rval;
}

fcport = sa_ctl->fcport;
Expand Down

0 comments on commit 6b504d0

Please sign in to comment.