From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbRG-00009B-Td for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYbRA-0000u1-MB for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:30 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:52827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYbRA-0000tB-FA for qemu-devel@nongnu.org; Mon, 29 Sep 2014 09:56:24 -0400 Received: by mail-lb0-f174.google.com with SMTP id l4so17745142lbv.5 for ; Mon, 29 Sep 2014 06:56:18 -0700 (PDT) From: Christoffer Dall Date: Mon, 29 Sep 2014 15:56:49 +0200 Message-Id: <1411999009-25241-1-git-send-email-christoffer.dall@linaro.org> Subject: [Qemu-devel] [PATCH] kvm: Fix error code check from kvm_vm_ioctl() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Christoffer Dall , Mario Smarduch 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. Cc: Mario Smarduch Signed-off-by: Christoffer Dall --- kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvm-all.c b/kvm-all.c index 4afcd05..ab57170 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -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; -- 2.0.0