From 3fe0df4843508ffc3517e82e9256c0e2d02932bd Mon Sep 17 00:00:00 2001 From: Swapnil Ingle Date: Thu, 10 Jun 2021 16:23:51 +0200 Subject: dma: Fix returned sg array (#564) _dma_addr_sg_split() is supposed to return back sg's if the requested dma addr spans across regions. Also adding unit tests to cover these case. Signed-off-by: Swapnil Ingle Reviewed-by: Thanos Makatos --- lib/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/dma.c b/lib/dma.c index 9270114..ffc0b6b 100644 --- a/lib/dma.c +++ b/lib/dma.c @@ -442,7 +442,7 @@ _dma_addr_sg_split(const dma_controller_t *dma, size_t region_len = MIN((uint64_t)(region_end - dma_addr), len); if (cnt < max_sg) { - ret = dma_init_sg(dma, sg, dma_addr, region_len, prot, idx); + ret = dma_init_sg(dma, &sg[cnt], dma_addr, region_len, prot, idx); if (ret < 0) { return ret; } -- cgit v1.1