diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2016-04-15 19:12:29 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-04-29 19:01:34 -0400 |
commit | 1354379b13f190ae5da21c26836a16ba56566ab3 (patch) | |
tree | ad9d15c40db01702375fc7e8867327ec843368e2 | |
parent | 71d397581d52c24c9903d9729aae09828f956801 (diff) |
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 <khoroshilov@ispras.ru>
Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/message/fusion/mptsas.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 7ebccfa8072a..7ee1667acde4 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -2281,7 +2281,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2281 | 2281 | ||
2282 | dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), | 2282 | dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), |
2283 | blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); | 2283 | blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); |
2284 | if (!dma_addr_out) | 2284 | if (pci_dma_mapping_error(ioc->pcidev, dma_addr_out)) |
2285 | goto put_mf; | 2285 | goto put_mf; |
2286 | ioc->add_sge(psge, flagsLength, dma_addr_out); | 2286 | ioc->add_sge(psge, flagsLength, dma_addr_out); |
2287 | psge += ioc->SGE_size; | 2287 | psge += ioc->SGE_size; |
@@ -2296,7 +2296,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2296 | flagsLength |= blk_rq_bytes(rsp) + 4; | 2296 | flagsLength |= blk_rq_bytes(rsp) + 4; |
2297 | dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), | 2297 | dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), |
2298 | blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); | 2298 | blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); |
2299 | if (!dma_addr_in) | 2299 | if (pci_dma_mapping_error(ioc->pcidev, dma_addr_in)) |
2300 | goto unmap; | 2300 | goto unmap; |
2301 | ioc->add_sge(psge, flagsLength, dma_addr_in); | 2301 | ioc->add_sge(psge, flagsLength, dma_addr_in); |
2302 | 2302 | ||