[PATCH] 53c700: add 'slot' check to NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'slot' variable allows a NULL value.
It is necessary to add a check for a null
value to avoid dereferencing the null pointer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Co-developed-by: Vladimir Telezhnikov <vtelezhnikov@xxxxxxxxxxxxx>
Signed-off-by: Vladimir Telezhnikov <vtelezhnikov@xxxxxxxxxxxxx>
Signed-off-by: Alexandra Diupina <adiupina@xxxxxxxxxxxxx>
---
 drivers/scsi/53c700.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index e1e4f9d10887..8e5468d1733d 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1598,6 +1598,8 @@ NCR_700_intr(int irq, void *dev_id)
 				printk("scsi%d (%d:%d) PHASE MISMATCH IN SEND MESSAGE %d remain, return %p[%04x], phase %s\n", host->host_no, pun, lun, count, (void *)temp, temp - hostdata->pScript, sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
 #endif
 				resume_offset = hostdata->pScript + Ent_SendMessagePhaseMismatch;
+			} else if (!slot) {
+				printk(KERN_ERR "53c700: SCSI DONE HAS NULL SCp\n");
 			} else if(dsp >= to32bit(&slot->pSG[0].ins) &&
 				  dsp <= to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) {
 				int data_transfer = NCR_700_readl(host, DBC_REG) & 0xffffff;
-- 
2.30.2




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux