
On 04/23/2013 12:24 AM, Eric Blake wrote:
On 04/22/2013 12:43 PM, Ján Tomko wrote:
qemuDomainPCIAddressGetNextSlot(qemuDomainPCIAddressSetPtr addrs, virDevicePCIAddressPtr next_addr) { - virDevicePCIAddress tmp_addr = addrs->lastaddr; - int i; - char *addr; + virDevicePCIAddress a = addrs->lastaddr;
- tmp_addr.slot++; - for (i = 0; i < QEMU_PCI_ADDRESS_SLOT_LAST; i++, tmp_addr.slot++) { - if (QEMU_PCI_ADDRESS_SLOT_LAST <= tmp_addr.slot) { - tmp_addr.slot = 0; - } + if (addrs->nbuses == 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("No PCI buses available")); + return -1; + }
addrs->nbuses should always be >= 1, now that we allocate it, right? Is it possible to hit this error?
It will be 0 when there is no PCI controller present and we'll hit this error when someone tries to use a PCI device on a machine with no PCI bus.