mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 13:30:52 +00:00
hw/pci: Have safer pcie_bus_realize() by checking error path
While pci_bus_realize() currently does not use the Error* argument, it would be an error to leave pcie_bus_realize() setting bus->flags if pci_bus_realize() had failed. Fix by using a local Error* and return early (propagating the error) if pci_bus_realize() failed. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210201153700.618946-1-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
fb59288239
commit
b52fa0ea45
@ -132,8 +132,13 @@ static void pci_bus_realize(BusState *qbus, Error **errp)
|
||||
static void pcie_bus_realize(BusState *qbus, Error **errp)
|
||||
{
|
||||
PCIBus *bus = PCI_BUS(qbus);
|
||||
Error *local_err = NULL;
|
||||
|
||||
pci_bus_realize(qbus, errp);
|
||||
pci_bus_realize(qbus, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* A PCI-E bus can support extended config space if it's the root
|
||||
|
Loading…
Reference in New Issue
Block a user