The "pci_bar_*" functions use 64-bit masks, but the results are assigned to 32-bit variables. Cast mask usages to 32-bit, since we're interested only in the least significant 4-bits. Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx> --- lib/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pci.c b/lib/pci.c index daa33e1..1b85411 100644 --- a/lib/pci.c +++ b/lib/pci.c @@ -107,7 +107,8 @@ pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id) uint32_t pci_bar_mask(uint32_t bar) { return (bar & PCI_BASE_ADDRESS_SPACE_IO) ? - PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK; + (uint32_t)PCI_BASE_ADDRESS_IO_MASK : + (uint32_t)PCI_BASE_ADDRESS_MEM_MASK; } uint32_t pci_bar_get(struct pci_dev *dev, int bar_num) -- 2.25.1.481.gfbce0eb801-goog