From patchwork Tue Dec 18 21:36:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: pcie: Fix bug in pcie_ext_cap_set_next Date: Tue, 18 Dec 2012 11:36:29 -0000 From: Knut Omang X-Patchwork-Id: 207230 Message-Id: <1355866589.8438.6.camel@ori.omang.mine.nu> To: qemu-devel@nongnu.org Cc: "Michael S.Tsirkin" Upper 16 bits of the PCIe Extended Capability Header was truncated during update, also breaking pcie_add_capability. Signed-off-by: Knut Omang --- hw/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pcie.c b/hw/pcie.c index 7c92f19..fa260af 100644 --- a/hw/pcie.c +++ b/hw/pcie.c @@ -494,7 +494,7 @@ uint16_t pcie_find_capability(PCIDevice *dev, uint16_t cap_id) static void pcie_ext_cap_set_next(PCIDevice *dev, uint16_t pos, uint16_t next) { - uint16_t header = pci_get_long(dev->config + pos); + uint32_t header = pci_get_long(dev->config + pos); assert(!(next & (PCI_EXT_CAP_ALIGN - 1))); header = (header & ~PCI_EXT_CAP_NEXT_MASK) | ((next << PCI_EXT_CAP_NEXT_SHIFT) & PCI_EXT_CAP_NEXT_MASK);