Skip to contentSkip to conversation

qemu-kvm: Fix assigned device config space

PATCH Applied Sheng Yang 2 participants 2 messages Nov 27, 2009 – Nov 30, 2009 KVM

lore
Share & tools
lore

Sheng Yang

author
#0 lore raw

PATCH 1/1 qemu-kvm: Fix assigned device config space

The new pci_dev->dev.config is a uint_8 pointer, but get_real_device() still using sizeof(pci_dev->dev.config) to fill the configuration space, which lost most of information.

Spot the issue when INTx cannot work again after previous fix...

---
 hw/device-assignment.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/device-assignment.c +1 -1
index 549ae67..13a86bb 100644
@@ -481,7 +481,7 @@ static int get_real_device(AssignedDevice *pci_dev, uint8_t r_bus,
     }
     dev->config_fd = fd;
 again:
-    r = read(fd, pci_dev->dev.config, sizeof(pci_dev->dev.config));
+    r = read(fd, pci_dev->dev.config, pci_config_size(&pci_dev->dev));
     if (r < 0) {
         if (errno == EINTR || errno == EAGAIN)
             goto again;
Signature · 1 line
1.5.4.5
#1 lore raw
Quoted 5 lines · Sheng Yang

The new pci_dev->dev.config is a uint_8 pointer, but get_real_device() still using sizeof(pci_dev->dev.config) to fill the configuration space, which lost most of information.

Spot the issue when INTx cannot work again after previous fix...

Applied, thanks.