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 <knut.omang@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
		
							parent
							
								
									d2a0ccc613
								
							
						
					
					
						commit
						812d2594d5
					
				@ -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)
 | 
					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)));
 | 
					    assert(!(next & (PCI_EXT_CAP_ALIGN - 1)));
 | 
				
			||||||
    header = (header & ~PCI_EXT_CAP_NEXT_MASK) |
 | 
					    header = (header & ~PCI_EXT_CAP_NEXT_MASK) |
 | 
				
			||||||
        ((next << PCI_EXT_CAP_NEXT_SHIFT) & PCI_EXT_CAP_NEXT_MASK);
 | 
					        ((next << PCI_EXT_CAP_NEXT_SHIFT) & PCI_EXT_CAP_NEXT_MASK);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user