From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFaUc-0006Hp-Hr for qemu-devel@nongnu.org; Thu, 16 Jul 2015 00:09:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFaUb-0005BG-SH for qemu-devel@nongnu.org; Thu, 16 Jul 2015 00:09:54 -0400 Received: from [59.151.112.132] (port=4208 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFaUa-00057f-G8 for qemu-devel@nongnu.org; Thu, 16 Jul 2015 00:09:53 -0400 From: Chen Hanxiao Date: Thu, 16 Jul 2015 12:00:42 +0800 Message-ID: <1437019253-17630-5-git-send-email-chenhanxiao@cn.fujitsu.com> In-Reply-To: <1437019253-17630-1-git-send-email-chenhanxiao@cn.fujitsu.com> References: <1437019253-17630-1-git-send-email-chenhanxiao@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH v12 04/15] vfio: make the 4 bytes aligned for capability size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson , qemu-devel@nongnu.org Cc: Chen Fan From: Chen Fan this function search the capability from the end, the last size should 0x100 - pos, not 0xff - pos. Signed-off-by: Chen Fan Signed-off-by: Chen Hanxiao --- hw/vfio/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index f9ff9c4..cae45a0 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2509,7 +2509,8 @@ static void vfio_unmap_bars(VFIOPCIDevice *vdev) */ static uint8_t vfio_std_cap_max_size(PCIDevice *pdev, uint8_t pos) { - uint8_t tmp, next = 0xff; + uint8_t tmp; + uint16_t next = PCI_CONFIG_SPACE_SIZE; for (tmp = pdev->config[PCI_CAPABILITY_LIST]; tmp; tmp = pdev->config[tmp + 1]) { -- 2.1.0