direct-io.hg
changeset 8507:e93340cf4d02
test return value of kmalloc to prevent crash is the allocation fail.
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author | vhanquez@kneesa.uk.xensource.com |
---|---|
date | Fri Jan 06 22:07:04 2006 +0000 (2006-01-06) |
parents | a933d82321b3 |
children | d92a68e6faa9 |
files | linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c |
line diff
1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Fri Jan 06 22:03:58 2006 +0000 1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c Fri Jan 06 22:07:04 2006 +0000 1.3 @@ -140,6 +140,8 @@ static ssize_t xenbus_dev_write(struct f 1.4 1.5 if (u->u.msg.type == XS_TRANSACTION_START) { 1.6 trans = kmalloc(sizeof(*trans), GFP_KERNEL); 1.7 + if (!trans) 1.8 + return -ENOMEM; 1.9 trans->handle = (struct xenbus_transaction *) 1.10 simple_strtoul(reply, NULL, 0); 1.11 list_add(&trans->list, &u->transactions);