From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: [PATCH 1/2] qemu-kvm: msix table update thinko fix Date: Wed, 22 Jul 2009 17:41:13 +0300 Message-ID: <20090722144113.GB7942@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: kvm@vger.kernel.org, avi@redhat.com, gleb@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:59875 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbZGVOmJ (ORCPT ); Wed, 22 Jul 2009 10:42:09 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6MEgAv5012745 for ; Wed, 22 Jul 2009 10:42:10 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: When updating msi irq routing entries, we should memcpy the new entry over the old one. Current code gets it wrong, and only works because it's uncommon for guests to change MSI tables. Signed-off-by: Michael S. Tsirkin --- qemu-kvm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index 60e5eac..cebaa65 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1552,7 +1552,7 @@ int kvm_update_routing_entry(kvm_context_t kvm, if (e->u.msi.address_lo == entry->u.msi.address_lo && e->u.msi.address_hi == entry->u.msi.address_hi && e->u.msi.data == entry->u.msi.data) { - memcpy(&e->u.msi, &entry->u.msi, sizeof e->u.msi); + memcpy(&e->u.msi, &newentry->u.msi, sizeof e->u.msi); return 0; } break; -- 1.6.2.5