From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4lzP-0004As-Mi for qemu-devel@nongnu.org; Tue, 16 Jun 2015 04:13:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4lzN-0004bS-OV for qemu-devel@nongnu.org; Tue, 16 Jun 2015 04:12:59 -0400 Received: from [59.151.112.132] (port=41971 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4lzN-0004Xn-DN for qemu-devel@nongnu.org; Tue, 16 Jun 2015 04:12:57 -0400 From: Chen Fan Date: Tue, 16 Jun 2015 16:10:47 +0800 Message-ID: <8c5428d545c9134dfff64581e54cbe1159b3a3a5.1434356309.git.chen.fan.fnst@cn.fujitsu.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [RFC v10 03/19] pcie: modify the capability size assert List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com 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. 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)); -- 1.9.3