Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1360973 > unrolled thread

[PATCH] mtip32xx: fix checks for dma mapping errors

Started byAlexey Khoroshilov <khoroshilov@ispras.ru>
First post2016-03-18 23:40 +0100
Last post2016-03-20 16:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mtip32xx: fix checks for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2016-03-18 23:40 +0100
    Re: [PATCH] mtip32xx: fix checks for dma mapping errors Jens Axboe <axboe@fb.com> - 2016-03-20 16:50 +0100

#1360973 — [PATCH] mtip32xx: fix checks for dma mapping errors

FromAlexey Khoroshilov <khoroshilov@ispras.ru>
Date2016-03-18 23:40 +0100
Subject[PATCH] mtip32xx: fix checks for dma mapping errors
Message-ID<rebdM-2ht-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1361307

FromJens Axboe <axboe@fb.com>
Date2016-03-20 16:50 +0100
Message-ID<reNM6-pp-11@gated-at.bofh.it>
In reply to#1360973
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web