mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
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>
This commit is contained in:
parent
e6a6dfe454
commit
aff427a1ca
5 changed files with 17 additions and 0 deletions
|
@ -1063,6 +1063,9 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
|
|||
d = (E1000State *)pci_register_device(bus, "e1000",
|
||||
sizeof(E1000State), devfn, NULL, NULL);
|
||||
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
pci_conf = d->dev.config;
|
||||
memset(pci_conf, 0, 256);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue