Skip to contentSkip to conversation

kvm: Fix error code check from kvm_vm_ioctl()

PATCH New Christoffer Dall 1 participant 1 message Sep 29, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: Fix error code check from kvm_vm_ioctl()

Currently kvm_physical_sync_dirty_bitmap() calls kvm_vm_ioctl() and checks if it returns -1. However, kvm_vm_ioctl() actually returns -errno, and not -1, so this check will fail and architectures not implementing this functionality in the kernel blindly attempt broken things like unimplemented dirty page logging for migration.

This addresses bug https://bugs.launchpad.net/qemu/+bug/1294227.

---
 kvm-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kvm-all.c +1 -1
index 4afcd05..ab57170 100644
@@ -429,7 +429,7 @@ static int kvm_physical_sync_dirty_bitmap(MemoryRegionSection *section)
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
+        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {
             DPRINTF("ioctl failed %d\n", errno);
             ret = -1;
             break;
Signature · 1 line
2.0.0