|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [Patch xen-unstable] mem alloc handling in xlvbd_init()
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) {
|
|
|
|
|