[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1400429439-11184-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Sun, 18 May 2014 18:10:39 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@....com>,
Sreekanth Reddy <Sreekanth.Reddy@....com>
Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
support@....com, "James E.J. Bottomley" <JBottomley@...allels.com>,
DL-MPTFusionLinux@....com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] scsi: mpt2sas: mpt2sas_base.c: Fix for possible null pointer dereference
There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
---
drivers/scsi/mpt2sas/mpt2sas_base.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index bde63f7..7ccc7e4 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -3581,7 +3581,9 @@ mpt2sas_port_enable_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
}
ioc->port_enable_cmds.status &= ~MPT2_CMD_PENDING;
- ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
+ if (mpi_reply) {
+ ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
+ }
if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
ioc->port_enable_failed = 1;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists