pcie: Fix bug in pcie_ext_cap_set_next
PATCH 1/1 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 <[email protected]>
--- hw/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pcie.c +1 -1
@@ -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 );
Signature · 1 line
1.7.11.7
Michael S. Tsirkin
AppliedQuoted 4 lines · Knut Omang
Upper 16 bits of the PCIe Extended Capability Header was truncated during update, also breaking
pcie_add_capability.Signed-off-by Knut Omang <[email protected]>
Applied, thanks.
Quoted 20 lines
--- hw/pcie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/pcie.c +1
-1@@ -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 );Signature · 1 line
1.7.11.7