Skip to contentSkip to conversation

vfio: Correction in vfio_rom_read when attempting rom loading

PATCH New Bandan Das 1 participant 1 message Feb 27, 2014

lore
Share & tools
lore

Bandan Das

author
#0 lore raw

PATCH 1/1 vfio: Correction in vfio_rom_read when attempting rom loading

commit e638073c569e801ce9de added a flag to track whether a previous rom read had failed. Accidentally, the code ended up adding vfio_load_option_rom twice. (Thanks to Alex for spotting it)

---
 hw/misc/vfio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
hw/misc/vfio.c +1 -4
index c2c688c..7147430 100644
@@ -1192,11 +1192,8 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size)
     uint64_t val = ((uint64_t)1 << (size * 8)) - 1;
 
     /* Load the ROM lazily when the guest tries to read it */
-    if (unlikely(!vdev->rom)) {
+    if (unlikely(!vdev->rom && !vdev->rom_read_failed)) {
         vfio_pci_load_rom(vdev);
-        if (unlikely(!vdev->rom && !vdev->rom_read_failed)) {
-            vfio_pci_load_rom(vdev);
-        }
     }
 
     memcpy(&val, vdev->rom + addr,
Signature · 1 line
1.8.3.1