From: Knut Omang Date: Tue, 18 Dec 2012 21:36:29 +0000 (+0100) Subject: pcie: Fix bug in pcie_ext_cap_set_next X-Git-Tag: v1.4.0-rc0~251^2~3 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=812d2594d558f7c4f95c99c8fc58adc47ab68eb3;p=users%2Fdwmw2%2Fqemu.git pcie: Fix bug in pcie_ext_cap_set_next Upper 16 bits of the PCIe Extended Capability Header was truncated during update, also breaking pcie_add_capability. Signed-off-by: Knut Omang Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 6c916d15ec..485c94c1b2 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/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);