From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKmU4-0008PK-QO for qemu-devel@nongnu.org; Sun, 17 Jan 2016 07:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKmTz-0001KK-Lf for qemu-devel@nongnu.org; Sun, 17 Jan 2016 07:31:04 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKmTz-0001KG-Dl for qemu-devel@nongnu.org; Sun, 17 Jan 2016 07:30:59 -0500 Received: by mail-wm0-x243.google.com with SMTP id 123so4141647wmz.2 for ; Sun, 17 Jan 2016 04:30:59 -0800 (PST) References: From: Marcel Apfelbaum Message-ID: <569B8980.6090605@gmail.com> Date: Sun, 17 Jan 2016 14:30:56 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v16 04/14] vfio: make the 4 bytes aligned for capability size Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin , qemu-devel@nongnu.org Cc: chen.fan.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com, mst@redhat.com On 01/12/2016 04:43 AM, Cao jin wrote: > From: Chen Fan > > this function search the capability from the end, the last > size should 0x100 - pos, not 0xff - pos. Indeed, "next" should be the first address of the next capability. Reviewed-by: Marcel Apfelbaum > > 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 a63cf85..288f2c7 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -1469,7 +1469,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]) { >