aboutsummaryrefslogtreecommitdiff
path: root/lib/dma.c
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-04-06 10:13:39 +0100
committerGitHub <noreply@github.com>2021-04-06 10:13:39 +0100
commit49a3bcdf4479e7001db0302c13af880485d0b3a3 (patch)
tree9dc0fb7911b653246882c21dedbfefeee919e7de /lib/dma.c
parentfe3f7540dbf3b3ba9346fd1deb6298ba163dd28d (diff)
downloadlibvfio-user-49a3bcdf4479e7001db0302c13af880485d0b3a3.zip
libvfio-user-49a3bcdf4479e7001db0302c13af880485d0b3a3.tar.gz
libvfio-user-49a3bcdf4479e7001db0302c13af880485d0b3a3.tar.bz2
dma_controller_remove_regions: reset region array (#413)
Prepare this function for re-usability by clearing the array after removal. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/dma.c')
-rw-r--r--lib/dma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/dma.c b/lib/dma.c
index d3db436..c524989 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -199,6 +199,9 @@ dma_controller_remove_regions(dma_controller_t *dma)
assert(region->fd == -1);
}
}
+
+ memset(dma->regions, 0, dma->max_regions * sizeof(dma->regions[0]));
+ dma->nregions = 0;
}
void