From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [patch 3/2] hotadd: lsi_scsi_init can fail Date: Tue, 22 Apr 2008 09:02:33 +0300 Message-ID: <480D7F79.7040700@qumranet.com> References: <20080421230247.814678086@sous-sol.org> <20080421230531.597310465@sous-sol.org> <20080422030229.GA10614@dmt> <20080422051457.GC3861@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net, Marcelo Tosatti To: Chris Wright Return-path: In-Reply-To: <20080422051457.GC3861@localhost.localdomain> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org 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 > Signed-off-by: Chris Wright > --- > 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. ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone