From: Alexey Khoroshilov Date: Fri, 15 Apr 2016 23:12:29 +0000 (+0300) Subject: mptsas: fix checks for dma mapping errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1354379b13f190ae5da21c26836a16ba56566ab3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Sathya Prakash Veerichetty Signed-off-by: Martin K. Petersen --- 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, dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio), blk_rq_bytes(req), PCI_DMA_BIDIRECTIONAL); - if (!dma_addr_out) + if (pci_dma_mapping_error(ioc->pcidev, dma_addr_out)) goto put_mf; ioc->add_sge(psge, flagsLength, dma_addr_out); psge += ioc->SGE_size; @@ -2296,7 +2296,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, flagsLength |= blk_rq_bytes(rsp) + 4; dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio), blk_rq_bytes(rsp), PCI_DMA_BIDIRECTIONAL); - if (!dma_addr_in) + if (pci_dma_mapping_error(ioc->pcidev, dma_addr_in)) goto unmap; ioc->add_sge(psge, flagsLength, dma_addr_in);