diff options
author | Chris Wright <chrisw@sous-sol.org> | 2008-04-21 16:02:48 -0700 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-05-01 09:47:14 -0500 |
commit | aff427a1ca09945082a4ec21aee2960306800fb0 (patch) | |
tree | 9aa24e8dbc09dc035a99e034c0347d2c7da3c919 /hw/eepro100.c | |
parent | e6a6dfe454c6b43abf9d5df8170950c4a9f28920 (diff) | |
download | qemu-aff427a1ca09945082a4ec21aee2960306800fb0.tar.gz |
Pci nic: pci_register_device can fail
The pci_register_device() call in PCI nic initialization routines can
fail. Handle this failure and propagate a meaningful error message to
the user instead of generating a SEGV.
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/eepro100.c')
-rw-r--r-- | hw/eepro100.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/eepro100.c b/hw/eepro100.c index 18d81153bf..235e598725 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -1739,6 +1739,9 @@ static PCIDevice *nic_init(PCIBus * bus, NICInfo * nd, uint32_t device) d = (PCIEEPRO100State *) pci_register_device(bus, nd->model, sizeof(PCIEEPRO100State), -1, NULL, NULL); + if (!d) + return NULL; + d->dev.unregister = pci_nic_uninit; s = &d->eepro100; |