Commit 1354379b authored by Alexey Khoroshilov's avatar Alexey Khoroshilov Committed by Martin K. Petersen

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: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: default avatarSathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 71d39758
...@@ -2281,7 +2281,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, ...@@ -2281,7 +2281,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL);
if (!dma_addr_out) if (pci_dma_mapping_error(ioc->pcidev, dma_addr_out))
goto put_mf; goto put_mf;
ioc->add_sge(psge, flagsLength, dma_addr_out); ioc->add_sge(psge, flagsLength, dma_addr_out);
psge += ioc->SGE_size; psge += ioc->SGE_size;
...@@ -2296,7 +2296,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, ...@@ -2296,7 +2296,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
flagsLength |= blk_rq_bytes(rsp) + 4; flagsLength |= blk_rq_bytes(rsp) + 4;
dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL);
if (!dma_addr_in) if (pci_dma_mapping_error(ioc->pcidev, dma_addr_in))
goto unmap; goto unmap;
ioc->add_sge(psge, flagsLength, dma_addr_in); ioc->add_sge(psge, flagsLength, dma_addr_in);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment