|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] Check kmalloc return value in vbd code.
ChangeSet 1.1794, 2005/03/18 09:18:26+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Check kmalloc return value in vbd code.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
vbd.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c 2005-03-18
05:07:20 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/vbd.c 2005-03-18
05:07:20 -05:00
@@ -496,21 +496,16 @@
{
int i;
- /*
- * If compiled as a module, we don't support unloading yet. We
- * therefore permanently increment the reference count to
- * disallow it.
- */
- /* MOD_INC_USE_COUNT; */
-
memset(major_info, 0, sizeof(major_info));
- for (i = 0; i < sizeof(major_info) / sizeof(major_info[0]); i++) {
+ vbd_info = kmalloc(MAX_VBDS * sizeof(vdisk_t), GFP_KERNEL);
+ if (vbd_info == NULL) {
+ printk(KERN_ALERT "Failed to allocate memory for disk info.\n");
+ nr_vbds = 0;
+ return 0;
}
- vbd_info = kmalloc(MAX_VBDS * sizeof(vdisk_t), GFP_KERNEL);
nr_vbds = xlvbd_get_vbd_info(vbd_info);
-
if (nr_vbds < 0) {
kfree(vbd_info);
vbd_info = NULL;
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog
|
|
|
|
|