* [PATCH] mptsas: fix checks for dma mapping errors
@ 2016-04-15 23:12 Alexey Khoroshilov
2016-04-28 1:18 ` Martin K. Petersen
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Khoroshilov @ 2016-04-15 23:12 UTC (permalink / raw)
To: Sreekanth Reddy, Sathya Prakash, Chaitra P B,
Suganath Prabu Subramani
Cc: Alexey Khoroshilov, MPT-FusionLinux.pdl, linux-scsi, linux-kernel,
ldv-project
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>
---
drivers/message/fusion/mptsas.c | 4 ++--
1 file 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,
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);
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mptsas: fix checks for dma mapping errors
2016-04-15 23:12 [PATCH] mptsas: fix checks for dma mapping errors Alexey Khoroshilov
@ 2016-04-28 1:18 ` Martin K. Petersen
2016-04-29 19:13 ` Sathya Prakash Veerichetty
0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2016-04-28 1:18 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Sreekanth Reddy, Sathya Prakash, Chaitra P B,
Suganath Prabu Subramani, MPT-FusionLinux.pdl, linux-scsi,
linux-kernel, ldv-project
>>>>> "Alexey" == Alexey Khoroshilov <khoroshilov@ispras.ru> writes:
Alexey> mptsas_smp_handler() checks for dma mapping errors by comparison
Alexey> returned address with zero, while pci_dma_mapping_error() should
Alexey> be used.
Broadcom folks, please review!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mptsas: fix checks for dma mapping errors
2016-04-28 1:18 ` Martin K. Petersen
@ 2016-04-29 19:13 ` Sathya Prakash Veerichetty
0 siblings, 0 replies; 3+ messages in thread
From: Sathya Prakash Veerichetty @ 2016-04-29 19:13 UTC (permalink / raw)
To: Martin K. Petersen, Alexey Khoroshilov
Cc: Sreekanth Reddy, Chaitra Basappa, Suganath Prabu Subramani,
PDL-MPT-FUSIONLINUX, linux-scsi, linux-kernel, ldv-project
Please consider this patch as Ack-by: Sathya Prakash
Veerichetty<sathya.prakash@broadcom.com>
PS: We don't have test environment to test this patch as this is for an
old controller. So ACKing based on code review and similar mpt3sas driver
code.
-----Original Message-----
From: Martin K. Petersen [mailto:martin.petersen@oracle.com]
Sent: Wednesday, April 27, 2016 7:18 PM
To: Alexey Khoroshilov
Cc: Sreekanth Reddy; Sathya Prakash; Chaitra P B; Suganath Prabu
Subramani; MPT-FusionLinux.pdl@broadcom.com; linux-scsi@vger.kernel.org;
linux-kernel@vger.kernel.org; ldv-project@linuxtesting.org
Subject: Re: [PATCH] mptsas: fix checks for dma mapping errors
>>>>> "Alexey" == Alexey Khoroshilov <khoroshilov@ispras.ru> writes:
Alexey> mptsas_smp_handler() checks for dma mapping errors by comparison
Alexey> returned address with zero, while pci_dma_mapping_error() should
Alexey> be used.
Broadcom folks, please review!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-29 19:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 23:12 [PATCH] mptsas: fix checks for dma mapping errors Alexey Khoroshilov
2016-04-28 1:18 ` Martin K. Petersen
2016-04-29 19:13 ` Sathya Prakash Veerichetty
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).