Skip to content

Commit 1354379

Browse files
khoroshilovmartinkpetersen
authored andcommitted
mptsas: fix checks for dma mapping errors
mptsas_smp_handler() checks for dma mapping errors by comparison returned address with zero, while pci_dma_mapping_error() should be used. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <[email protected]> Acked-by: Sathya Prakash Veerichetty <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 71d3975 commit 1354379

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/message/fusion/mptsas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
22812281

22822282
dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
22832283
blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL);
2284-
if (!dma_addr_out)
2284+
if (pci_dma_mapping_error(ioc->pcidev, dma_addr_out))
22852285
goto put_mf;
22862286
ioc->add_sge(psge, flagsLength, dma_addr_out);
22872287
psge += ioc->SGE_size;
@@ -2296,7 +2296,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
22962296
flagsLength |= blk_rq_bytes(rsp) + 4;
22972297
dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
22982298
blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL);
2299-
if (!dma_addr_in)
2299+
if (pci_dma_mapping_error(ioc->pcidev, dma_addr_in))
23002300
goto unmap;
23012301
ioc->add_sge(psge, flagsLength, dma_addr_in);
23022302

0 commit comments

Comments
 (0)