diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 34accdf615..2386b511f3 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -451,8 +451,13 @@ static void vhost_commit(MemoryListener *listener) changed = true; } else { /* Same size, lets check the contents */ - changed = n_old_sections && memcmp(dev->mem_sections, old_sections, - n_old_sections * sizeof(old_sections[0])) != 0; + for (int i = 0; i < n_old_sections; i++) { + if (!MemoryRegionSection_eq(&old_sections[i], + &dev->mem_sections[i])) { + changed = true; + break; + } + } } trace_vhost_commit(dev->started, changed);