VFIO is always little endian so do byte swapping of our mask on the
way in and byte swapping of the size on the way out.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
static void vfio_pci_size_rom(VFIODevice *vdev)
{
- uint32_t orig, size = (uint32_t)PCI_ROM_ADDRESS_MASK;
+ uint32_t orig, size = cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK);
off_t offset = vdev->config_offset + PCI_ROM_ADDRESS;
char name[32];
return;
}
- size = ~(size & PCI_ROM_ADDRESS_MASK) + 1;
+ size = ~(le32_to_cpu(size) & PCI_ROM_ADDRESS_MASK) + 1;
if (!size) {
return;