public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [SCSI] mpt3sas: move dereference under check
@ 2013-03-11 11:40 Dan Carpenter
       [not found] ` <DCD177647606E9419ED923E0C8C4AA7223E78BBBA3@inbmail02.lsi.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-03-11 11:40 UTC (permalink / raw)
  To: Nagalakshmi Nandigama
  Cc: Sreekanth Reddy, support, James E.J. Bottomley, DL-MPTFusionLinux,
	linux-scsi, linux-kernel, kernel-janitors

pci_pool_free() dereferences "ioc->sense_dma_pool" but we check it
for NULL on the following line.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 1836003..06a84ef 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -2479,9 +2479,11 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
 	}
 
 	if (ioc->sense) {
-		pci_pool_free(ioc->sense_dma_pool, ioc->sense, ioc->sense_dma);
-		if (ioc->sense_dma_pool)
+		if (ioc->sense_dma_pool) {
+			pci_pool_free(ioc->sense_dma_pool, ioc->sense,
+				      ioc->sense_dma);
 			pci_pool_destroy(ioc->sense_dma_pool);
+		}
 		dexitprintk(ioc, pr_info(MPT3SAS_FMT
 			"sense_pool(0x%p): free\n",
 			ioc->name, ioc->sense));

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-14 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11 11:40 [patch] [SCSI] mpt3sas: move dereference under check Dan Carpenter
     [not found] ` <DCD177647606E9419ED923E0C8C4AA7223E78BBBA3@inbmail02.lsi.com>
2013-03-14 14:34   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox