From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M8t39-0004SR-R3 for qemu-devel@nongnu.org; Tue, 26 May 2009 05:34:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M8t32-0004Qy-9N for qemu-devel@nongnu.org; Tue, 26 May 2009 05:34:22 -0400 Received: from [199.232.76.173] (port=49720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M8t32-0004Qv-2F for qemu-devel@nongnu.org; Tue, 26 May 2009 05:34:16 -0400 Received: from mx2.redhat.com ([66.187.237.31]:52292) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M8t31-0002Kh-EK for qemu-devel@nongnu.org; Tue, 26 May 2009 05:34:15 -0400 Date: Tue, 26 May 2009 12:30:27 +0300 From: "Michael S. Tsirkin" Message-ID: <20090526093027.GC8588@redhat.com> References: <20090525122520.GD5046@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090525122520.GD5046@redhat.com> Subject: [Qemu-devel] [PATCH] qemu: fix pci_find_capability for multiple caps List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook , Avi Kivity , qemu-devel@nongnu.org, Carsten Otte , kvm@vger.kernel.org, Rusty Russell , virtualization@lists.linux-foundation.org, Christian Borntraeger , Blue Swirl pci_find_capability_list has a bug so it'd stop at the first capability. This only happens to work as we only support a single capability (MSI-X). Here's a fix. Found-by: Isaku Yamahata Signed-off-by: Michael S. Tsirkin --- This is a fixup for my patch "qemu: add routines to manage PCI capabilities". hw/pci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 19905b9..a63d988 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -918,7 +918,7 @@ static uint8_t pci_find_capability_list(PCIDevice *pdev, uint8_t cap_id, for (prev = PCI_CAPABILITY_LIST; (next = pdev->config[prev]); prev = next + PCI_CAP_LIST_NEXT) - if (pdev->config[next + PCI_CAP_LIST_ID] != cap_id) + if (pdev->config[next + PCI_CAP_LIST_ID] == cap_id) break; *prev_p = prev; -- MST