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

[Xen-changelog] test return value of kmalloc to prevent crash is the allocation fail.



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID e93340cf4d02e3d4d3166769617981b8d9892432
# Parent  a933d82321b3c638879e725a911bf52ed5413eec
test return value of kmalloc to prevent crash is the allocation fail.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>

diff -r a933d82321b3 -r e93340cf4d02 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Fri Jan  6 
22:03:58 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Fri Jan  6 
22:07:04 2006
@@ -140,6 +140,8 @@
 
                if (u->u.msg.type == XS_TRANSACTION_START) {
                        trans = kmalloc(sizeof(*trans), GFP_KERNEL);
+                       if (!trans)
+                               return -ENOMEM;
                        trans->handle = (struct xenbus_transaction *)
                                simple_strtoul(reply, NULL, 0);
                        list_add(&trans->list, &u->transactions);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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