Fix dma_unmap_sg() nents value
Subsystems (2)
PATCH 1/1 Fix dma_unmap_sg() nents value
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
Fixes ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")
Signed-off-by Thomas Fourier <[email protected]>
--- drivers/infiniband/hw/erdma/erdma_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/erdma/erdma_verbs.c +2 -1
@@ -629,7 +629,8 @@ static struct erdma_mtt *erdma_create_cont_mtt(struct erdma_dev *dev,static void erdma_destroy_mtt_buf_sg (struct erdma_dev *dev,struct erdma_mtt *mtt) { -dma_unmap_sg (&dev->pdev->dev, mtt->sglist, mtt->nsg,DMA_TO_DEVICE ); +dma_unmap_sg (&dev->pdev->dev, mtt->sglist, +DIV_ROUND_UP (mtt->size,PAGE_SIZE ),DMA_TO_DEVICE );vfree (mtt->sglist); }
Signature · 1 line
2.43.0
Leon Romanovsky
AppliedQuoted 4 lines · Thomas Fourier
The
dma_unmap_sg()functions should be called with the same nents as thedma_map_sg(), not the value the map function returned.
Applied, thanks!
[1/1] Fix dma_unmap_sg() nents value
https://git.kernel.org/rdma/rdma/c/4d67f2ac89a892
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>
Cheng Xu
maintainerQuoted 9 lines · Thomas Fourier
The
dma_unmap_sg()functions should be called with the same nents as thedma_map_sg(), not the value the map function returned.Fixes ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")Signed-off-by Thomas Fourier <[email protected]>--- drivers/infiniband/hw/erdma/erdma_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Hi Thomas,
This patch is already accepted by Leon, and a late thanks to you.
Cheng Xu
Quoted 14 lines
drivers/infiniband/hw/erdma/erdma_verbs.c +2
-1@@ -629,7 +629,8 @@ static struct erdma_mtt *erdma_create_cont_mtt(struct erdma_dev *dev,static void erdma_destroy_mtt_buf_sg (struct erdma_dev *dev,struct erdma_mtt *mtt) { -dma_unmap_sg (&dev->pdev->dev, mtt->sglist, mtt->nsg,DMA_TO_DEVICE ); +dma_unmap_sg (&dev->pdev->dev, mtt->sglist, +DIV_ROUND_UP (mtt->size,PAGE_SIZE ),DMA_TO_DEVICE );vfree (mtt->sglist); }