[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Patch xen-unstable] mem alloc handling in xlvbd_init()


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxxx
  • From: Nivedita Singhvi <niv@xxxxxxxxxx>
  • Date: Thu, 17 Mar 2005 15:53:38 -0800
  • Delivery-date: Fri, 18 Mar 2005 00:12:47 +0000
  • List-id: List for Xen developers <xen-devel.lists.sourceforge.net>

Minor nit: would be nice to die gracefully if we fail
to allocate memory in xlvbd_init() instead of blowing
up in xlvbd_get_vbd_info().

thanks,
Nivedita


diff -urN linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c 
linux-2.6.11-xen-sparse.new/drivers/xen/blkfront/vbd.c
--- linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c  2005-03-14 
20:18:19.000000000 -0800
+++ linux-2.6.11-xen-sparse.new/drivers/xen/blkfront/vbd.c      2005-03-17 
15:03:22.000000000 -0800
@@ -548,6 +548,11 @@
     }
 
     vbd_info = kmalloc(MAX_VBDS * sizeof(vdisk_t), GFP_KERNEL);
+    if (unlikely(vbd_info == NULL)) {
+       printk("KERN_ALERT Failed to allocate memory for disk info\n");
+       nr_vbds = 0;
+       return 0;       
+    }
     nr_vbds  = xlvbd_get_vbd_info(vbd_info);
 
     if (nr_vbds < 0) {

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.