diff options
-rw-r--r-- | hw/pci.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -856,9 +856,9 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int l) int i; uint32_t config_size = pci_config_size(d); - for(i = 0; i < l && addr < config_size; val >>= 8, ++i, ++addr) { - uint8_t wmask = d->wmask[addr]; - d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask); + for (i = 0; i < l && addr + i < config_size; val >>= 8, ++i) { + uint8_t wmask = d->wmask[addr + i]; + d->config[addr + i] = (d->config[addr + i] & ~wmask) | (val & wmask); } if (ranges_overlap(addr, l, PCI_BASE_ADDRESS_0, 24) || ranges_overlap(addr, l, PCI_ROM_ADDRESS, 4) || |