Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: 53c700: Check that command slot is not NULL

Add a check for the command slot value to avoid dereferencing a NULL
pointer.

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

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Co-developed-by: Vladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: Vladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Link: https://lore.kernel.org/r/20230728123521.18293-1-adiupina@astralinux.ru
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Alexandra Diupina and committed by
Martin K. Petersen
8366d1f1 5a43b07a

+1 -1
+1 -1
drivers/scsi/53c700.c
··· 1598 1598 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))); 1599 1599 #endif 1600 1600 resume_offset = hostdata->pScript + Ent_SendMessagePhaseMismatch; 1601 - } else if(dsp >= to32bit(&slot->pSG[0].ins) && 1601 + } else if (slot && dsp >= to32bit(&slot->pSG[0].ins) && 1602 1602 dsp <= to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) { 1603 1603 int data_transfer = NCR_700_readl(host, DBC_REG) & 0xffffff; 1604 1604 int SGcount = (dsp - to32bit(&slot->pSG[0].ins))/sizeof(struct NCR_700_SG_List);