aboutsummaryrefslogtreecommitdiff
path: root/lib/dma.c
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-06-24 02:20:48 -0700
committerThanos Makatos <thanos.makatos@nutanix.com>2020-06-24 02:20:48 -0700
commit9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229 (patch)
tree39a5c2a8e314b0951aa62344a2085a73a4eef015 /lib/dma.c
parent883d8e66c0cbba493e78d4077b8c0b1b01e987d8 (diff)
downloadlibvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.zip
libvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.tar.gz
libvfio-user-9d8a0e61b8294c1d590e56cd78c0bdd3cc5c2229.tar.bz2
don't blindly trust region_hint
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/dma.c')
-rw-r--r--lib/dma.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/dma.c b/lib/dma.c
index deb5511..cc79807 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -116,6 +116,10 @@ dma_controller_remove_region(lm_ctx_t *lm_ctx, dma_controller_t *dma,
if (region->dma_addr == dma_addr && region->size == size) {
_dma_controller_do_remove_region(lm_ctx, region);
if (dma->nregions > 1)
+ /*
+ * FIXME valgrind complains with 'Source and destination overlap in memcpy',
+ * check whether memmove eliminates this warning.
+ */
memcpy(region, &dma->regions[dma->nregions - 1],
sizeof *region);
dma->nregions--;