From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z59su-0001Ke-HY for qemu-devel@nongnu.org; Wed, 17 Jun 2015 05:43:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z59sr-0001m4-Ar for qemu-devel@nongnu.org; Wed, 17 Jun 2015 05:43:52 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:34322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z59sr-0001ls-4Q for qemu-devel@nongnu.org; Wed, 17 Jun 2015 05:43:49 -0400 Received: by wicnd19 with SMTP id nd19so77194358wic.1 for ; Wed, 17 Jun 2015 02:43:48 -0700 (PDT) Message-ID: <55814152.7040406@gmail.com> Date: Wed, 17 Jun 2015 12:43:46 +0300 From: Marcel Apfelbaum MIME-Version: 1.0 References: <8c5428d545c9134dfff64581e54cbe1159b3a3a5.1434356309.git.chen.fan.fnst@cn.fujitsu.com> In-Reply-To: <8c5428d545c9134dfff64581e54cbe1159b3a3a5.1434356309.git.chen.fan.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v10 03/19] pcie: modify the capability size assert Reply-To: marcel@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Fan , qemu-devel@nongnu.org Cc: izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com On 06/16/2015 11:10 AM, Chen Fan wrote: > because the capabilities need to be DWORD aligned, so the size > should DWORD aligned too, and then the last capability size can > to be the greatest 0x1000. e.g. if I have a capability starting > 4 bytes from the end, 0xFFC. The max size should be 4 bytes, > 0x1000 - 0xFFC, not 3 bytes, 0xFFF - 0xFFC. I would re-word the message to something simpler like: Offset and size can reach PCIE_CONFIG_SPACE_SIZE, fix the corresponding assert. Other than that, Reviewed-by: Marcel Apfelbaum Thanks, Marcel > > Signed-off-by: Chen Fan > --- > hw/pci/pcie.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c > index 1463e65..6cdd4a1 100644 > --- a/hw/pci/pcie.c > +++ b/hw/pci/pcie.c > @@ -595,7 +595,7 @@ void pcie_add_capability(PCIDevice *dev, > > assert(offset >= PCI_CONFIG_SPACE_SIZE); > assert(offset < offset + size); > - assert(offset + size < PCIE_CONFIG_SPACE_SIZE); > + assert(offset + size <= PCIE_CONFIG_SPACE_SIZE); > assert(size >= 8); > assert(pci_is_express(dev)); > >