Skip to contentSkip to conversation

scsi: 53c700: pass correct "dev" to dma_alloc_attrs()

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 24, 2019 – Jan 29, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: 53c700: pass correct "dev" to dma_alloc_attrs()

The "hostdata->dev" pointer is NULL here. We set "hostdata->dev = dev;" later in the function and we also use "hostdata->dev" when we call dma_free_attrs() in NCR_700_release().

This bug predates git version control.

---
I just noticed this when I was reviewing some static checker stuff. I have not tested it.

 drivers/scsi/53c700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/53c700.c +1 -1
index 128d658d472a..16957d7ac414 100644
@@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
 	if(tpnt->sdev_attrs = NULL)
 		tpnt->sdev_attrs = NCR_700_dev_attrs;
 
-	memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript,
+	memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript,
 				 GFP_KERNEL, DMA_ATTR_NON_CONSISTENT);
 	if(memory = NULL) {
 		printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n");
Signature · 1 line
2.17.1
#1 lore raw

Dan,

Quoted 5 lines

The "hostdata->dev" pointer is NULL here. We set "hostdata->dev = dev;" later in the function and we also use "hostdata->dev" when we call dma_free_attrs() in NCR_700_release().

This bug predates git version control.

Applied to 5.0/scsi-fixes, thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering