From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 2/2] [PATCH] virtio-blk: virtio_pci_init can fail Date: Tue, 22 Apr 2008 00:02:29 -0300 Message-ID: <20080422030229.GA10614@dmt> References: <20080421230247.814678086@sous-sol.org> <20080421230531.597310465@sous-sol.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Chris Wright Return-path: Content-Disposition: inline In-Reply-To: <20080421230531.597310465@sous-sol.org> 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 Looks good. Does SCSI handle pci_register_device() failure too? Acked-by: Marcelo Tosatti On Mon, Apr 21, 2008 at 04:02:49PM -0700, Chris Wright wrote: > The pci_device_register() call in virtio_pci_init() can fail. > Handle this error condition instead of generating a SEGV. > > Cc: Marcelo Tosatti > Signed-off-by: Chris Wright > --- > qemu/hw/virtio-blk.c | 2 ++ > 1 file changed, 2 insertions(+) > > --- a/qemu/hw/virtio-blk.c > +++ b/qemu/hw/virtio-blk.c > @@ -163,6 +163,8 @@ void *virtio_blk_init(PCIBus *bus, uint1 > 0, VIRTIO_ID_BLOCK, > 0x01, 0x80, 0x00, > sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); > + if (!s) > + return NULL; > > s->vdev.update_config = virtio_blk_update_config; > s->vdev.get_features = virtio_blk_get_features; > > -- ------------------------------------------------------------------------- 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