[PATCH] isci: Fix dma_unmap_sg() nents value

Thomas Fourier posted 1 patch 3 months, 1 week ago
drivers/scsi/isci/request.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] isci: Fix dma_unmap_sg() nents value
Posted by Thomas Fourier 3 months, 1 week ago
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: ddcc7e347a89 ("isci: fix dma_unmap_sg usage")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/scsi/isci/request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 355a0bc0828e..bb89a2e33eb4 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -2904,7 +2904,7 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
 					 task->total_xfer_len, task->data_dir);
 		else  /* unmap the sgl dma addresses */
 			dma_unmap_sg(&ihost->pdev->dev, task->scatter,
-				     request->num_sg_entries, task->data_dir);
+				     task->num_scatter, task->data_dir);
 		break;
 	case SAS_PROTOCOL_SMP: {
 		struct scatterlist *sg = &task->smp_task.smp_req;
-- 
2.43.0
Re: [PATCH] isci: Fix dma_unmap_sg() nents value
Posted by Martin K. Petersen 2 months, 2 weeks ago
On Fri, 27 Jun 2025 16:24:47 +0200, Thomas Fourier wrote:

> The dma_unmap_sg() functions should be called with the same nents as the
> dma_map_sg(), not the value the map function returned.
> 
> 

Applied to 6.17/scsi-queue, thanks!

[1/1] isci: Fix dma_unmap_sg() nents value
      https://git.kernel.org/mkp/scsi/c/063bec4444d5

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH] isci: Fix dma_unmap_sg() nents value
Posted by Martin K. Petersen 2 months, 3 weeks ago
Thomas,

> The dma_unmap_sg() functions should be called with the same nents as
> the dma_map_sg(), not the value the map function returned.

Applied to 6.17/scsi-staging, thanks!

-- 
Martin K. Petersen