From patchwork Wed Nov 11 10:34:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cao jin X-Patchwork-Id: 542847 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0AE411402B0 for ; Wed, 11 Nov 2015 21:39:20 +1100 (AEDT) Received: from localhost ([::1]:39152 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwSo9-0008Ir-Rg for incoming@patchwork.ozlabs.org; Wed, 11 Nov 2015 05:39:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwSkm-0003Kh-KO for qemu-devel@nongnu.org; Wed, 11 Nov 2015 05:36:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwSk0-0003iQ-Pa for qemu-devel@nongnu.org; Wed, 11 Nov 2015 05:35:48 -0500 Received: from [59.151.112.132] (port=8297 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwSk0-0003d7-6L for qemu-devel@nongnu.org; Wed, 11 Nov 2015 05:35:00 -0500 X-IronPort-AV: E=Sophos;i="5.20,242,1444665600"; d="scan'208";a="344612" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Nov 2015 18:34:25 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id tABAXvVI014316; Wed, 11 Nov 2015 18:33:57 +0800 Received: from G08FNSTD140223.g08.fujitsu.local (10.167.226.57) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 11 Nov 2015 18:34:37 +0800 From: Cao jin To: Date: Wed, 11 Nov 2015 18:34:22 +0800 Message-ID: X-Mailer: git-send-email 2.1.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.57] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: Chen Fan , alex.williamson@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v13 04/13] vfio: make the 4 bytes aligned for capability size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 f333dfc..e305cda 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -1468,7 +1468,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]) {