From: Avi K. <av...@qu...> - 2008-04-22 06:03:40
|
Chris Wright wrote: > During hotadd of SCSI devices lsi_scsi_init() handles failed > pci_device_register(), but qemu_system_hot_add_storage() will try and > attach a drive any way. Handle this error case rather the generating > SEGV. > > Cc: Marcelo Tosatti <mto...@re...> > Signed-off-by: Chris Wright <ch...@so...> > --- > qemu/hw/device-hotplug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- a/qemu/hw/device-hotplug.c > +++ b/qemu/hw/device-hotplug.c > @@ -125,7 +125,7 @@ static PCIDevice *qemu_system_hot_add_st > switch (type) { > case IF_SCSI: > opaque = lsi_scsi_init (pci_bus, -1); > - if (drive_idx >= 0) > + if (opaque && drive_idx >= 0) > lsi_scsi_attach (opaque, drives_table[drive_idx].bdrv, > drives_table[drive_idx].unit); > break; > It's not so opaque if you're testing it against NULL... long term we want better error reporting here. -- Any sufficiently difficult bug is indistinguishable from a feature. |