aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSwapnil Ingle <swapnil.ingle@nutanix.com>2021-06-10 16:23:51 +0200
committerGitHub <noreply@github.com>2021-06-10 16:23:51 +0200
commit3fe0df4843508ffc3517e82e9256c0e2d02932bd (patch)
treec8b3dfe29d0a2166653a38f8efebd0aa8baf96bb /lib
parent8b6db2e0b3b340dd747c735e48a4691619e063ce (diff)
downloadlibvfio-user-3fe0df4843508ffc3517e82e9256c0e2d02932bd.zip
libvfio-user-3fe0df4843508ffc3517e82e9256c0e2d02932bd.tar.gz
libvfio-user-3fe0df4843508ffc3517e82e9256c0e2d02932bd.tar.bz2
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 <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma.c2
1 files changed, 1 insertions, 1 deletions
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;
}