From 6697b57398c20145f649d84028fec033dca52002 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 1 May 2019 22:37:52 +0000 Subject: [PATCH] qla2xxx-32gbit: Avoid that Coverity complains about dereferencing a NULL rport pointer Since Coverity cannot know that rport != NULL in qla2xxx_queuecommand() and since there is code in that function that dereferences the rport pointer, modify qla2xxx_queuecommand() such that it fails SCSI commands if rport == NULL. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8292 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 96495fcb2..b2c7eebca 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -948,7 +948,8 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) srb_t *sp; int rval; - if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) { + if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags)) || + WARN_ON_ONCE(!rport)) { cmd->result = DID_NO_CONNECT << 16; goto qc24_fail_command; } @@ -1077,7 +1078,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd, srb_t *sp; int rval; - rval = fc_remote_port_chkready(rport); + rval = rport ? fc_remote_port_chkready(rport) : FC_PORTSTATE_OFFLINE; if (rval) { cmd->result = rval; ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3076,