From: David Hildenbrand Date: Wed, 14 Feb 2024 15:16:55 +0000 (+0100) Subject: libvhost-user: Don't search for duplicates when removing memory regions X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9c254cb413a631f6601e6e34429547759d7d63a6;p=qemu.git libvhost-user: Don't search for duplicates when removing memory regions We cannot have duplicate memory regions, something would be deeply flawed elsewhere. Let's just stop the search once we found an entry. We'll add more sanity checks when adding memory regions later. Reviewed-by: Raphael Norwitz Acked-by: Stefano Garzarella Signed-off-by: David Hildenbrand Message-Id: <20240214151701.29906-9-david@redhat.com> Tested-by: Mario Casquero Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index 2e8b611385..7f29e01c30 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -896,8 +896,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { i--; found = true; - - /* Continue the search for eventual duplicates. */ + break; } }