aboutsummaryrefslogtreecommitdiffstats
path: root/hw/eepro100.c
diff options
context:
space:
mode:
authorChris Wright <chrisw@sous-sol.org>2008-04-21 16:02:48 -0700
committerAnthony Liguori <aliguori@us.ibm.com>2009-05-01 09:47:14 -0500
commitaff427a1ca09945082a4ec21aee2960306800fb0 (patch)
tree9aa24e8dbc09dc035a99e034c0347d2c7da3c919 /hw/eepro100.c
parente6a6dfe454c6b43abf9d5df8170950c4a9f28920 (diff)
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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 18d81153b..235e59872 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;