linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtip32xx: fix checks for dma mapping errors
@ 2016-03-18 22:35 Alexey Khoroshilov
  2016-03-20 15:47 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2016-03-18 22:35 UTC (permalink / raw)
  To: Jens Axboe, Asai Thambi SP, Selvan Mani
  Cc: Alexey Khoroshilov, linux-kernel, ldv-project

exec_drive_taskfile() 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/block/mtip32xx/mtip32xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 9b180dbbd03c..06390f2a7d85 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2039,7 +2039,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
 					 outbuf,
 					 taskout,
 					 DMA_TO_DEVICE);
-		if (outbuf_dma == 0) {
+		if (pci_dma_mapping_error(dd->pdev, outbuf_dma)) {
 			err = -ENOMEM;
 			goto abort;
 		}
@@ -2056,7 +2056,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
 		inbuf_dma = pci_map_single(dd->pdev,
 					 inbuf,
 					 taskin, DMA_FROM_DEVICE);
-		if (inbuf_dma == 0) {
+		if (pci_dma_mapping_error(dd->pdev, inbuf_dma)) {
 			err = -ENOMEM;
 			goto abort;
 		}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtip32xx: fix checks for dma mapping errors
  2016-03-18 22:35 [PATCH] mtip32xx: fix checks for dma mapping errors Alexey Khoroshilov
@ 2016-03-20 15:47 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2016-03-20 15:47 UTC (permalink / raw)
  To: Alexey Khoroshilov, Asai Thambi SP, Selvan Mani; +Cc: linux-kernel, ldv-project

On 03/18/2016 04:35 PM, Alexey Khoroshilov wrote:
> exec_drive_taskfile() 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).

Thanks, applied.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-20 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 22:35 [PATCH] mtip32xx: fix checks for dma mapping errors Alexey Khoroshilov
2016-03-20 15:47 ` Jens Axboe

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).