提交 5173cb81 编写于 作者: A Alexey Khoroshilov 提交者: Jens Axboe

mtip32xx: fix checks for dma mapping errors

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: NAlexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 29fd20b8
...@@ -2051,7 +2051,7 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2051,7 +2051,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
outbuf, outbuf,
taskout, taskout,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (outbuf_dma == 0) { if (pci_dma_mapping_error(dd->pdev, outbuf_dma)) {
err = -ENOMEM; err = -ENOMEM;
goto abort; goto abort;
} }
...@@ -2068,7 +2068,7 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2068,7 +2068,7 @@ static int exec_drive_taskfile(struct driver_data *dd,
inbuf_dma = pci_map_single(dd->pdev, inbuf_dma = pci_map_single(dd->pdev,
inbuf, inbuf,
taskin, DMA_FROM_DEVICE); taskin, DMA_FROM_DEVICE);
if (inbuf_dma == 0) { if (pci_dma_mapping_error(dd->pdev, inbuf_dma)) {
err = -ENOMEM; err = -ENOMEM;
goto abort; goto abort;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册