aboutsummaryrefslogtreecommitdiff
path: root/util/iova-tree.c
diff options
context:
space:
mode:
authorEugenio Pérez <eperezma@redhat.com>2022-08-23 20:20:04 +0200
committerJason Wang <jasowang@redhat.com>2022-09-02 10:22:39 +0800
commit69292a8e40f4dae8af5f04724e06392cdf03c09e (patch)
treeb696af6c4f0145432adff7ed82427e9cf36d7126 /util/iova-tree.c
parent7dab70bec397e3522211e7bcc36d879bad8154c5 (diff)
downloadqemu-69292a8e40f4dae8af5f04724e06392cdf03c09e.zip
qemu-69292a8e40f4dae8af5f04724e06392cdf03c09e.tar.gz
qemu-69292a8e40f4dae8af5f04724e06392cdf03c09e.tar.bz2
util: accept iova_tree_remove_parameter by value
It's convenient to call iova_tree_remove from a map returned from iova_tree_find or iova_tree_find_iova. With the current code this is not possible, since we will free it, and then we will try to search for it again. Fix it making accepting the map by value, forcing a copy of the argument. Not applying a fixes tag, since there is no use like that at the moment. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'util/iova-tree.c')
-rw-r--r--util/iova-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/iova-tree.c b/util/iova-tree.c
index fee530a..5367897 100644
--- a/util/iova-tree.c
+++ b/util/iova-tree.c
@@ -164,11 +164,11 @@ void iova_tree_foreach(IOVATree *tree, iova_tree_iterator iterator)
g_tree_foreach(tree->tree, iova_tree_traverse, iterator);
}
-void iova_tree_remove(IOVATree *tree, const DMAMap *map)
+void iova_tree_remove(IOVATree *tree, DMAMap map)
{
const DMAMap *overlap;
- while ((overlap = iova_tree_find(tree, map))) {
+ while ((overlap = iova_tree_find(tree, &map))) {
g_tree_remove(tree->tree, overlap);
}
}