diff mbox

pcie: Fix bug in pcie_ext_cap_set_next

Message ID 1355866589.8438.6.camel@ori.omang.mine.nu
State New
Headers show

Commit Message

Knut Omang Dec. 18, 2012, 9:36 p.m. UTC
Upper 16 bits of the PCIe Extended Capability Header was truncated during update,
also breaking pcie_add_capability.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
---
 hw/pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael S. Tsirkin Dec. 25, 2012, 12:18 p.m. UTC | #1
On Tue, Dec 18, 2012 at 10:36:29PM +0100, Knut Omang wrote:
> Upper 16 bits of the PCIe Extended Capability Header was truncated during update,
> also breaking pcie_add_capability.
> 
> Signed-off-by: Knut Omang <knut.omang@oracle.com>

Applied, thanks.

> ---
>  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);
> -- 
> 1.7.11.7
>
diff mbox

Patch

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);