2006-01-19 21:32:53

by David Teigland

[permalink] [raw]
Subject: [PATCH 6/7] dlm: use kzalloc

Use kzalloc.

Signed-off-by: David Teigland <[email protected]>

Index: linux/drivers/dlm/device.c
===================================================================
--- linux.orig/drivers/dlm/device.c 2006-01-19 13:38:38.978178974 -0600
+++ linux/drivers/dlm/device.c 2006-01-19 13:38:54.847754011 -0600
@@ -236,12 +236,11 @@

namelen = strlen(name)+strlen(name_prefix)+2;

- newls = kmalloc(sizeof(struct user_ls), GFP_KERNEL);
+ newls = kzalloc(sizeof(struct user_ls), GFP_KERNEL);
if (!newls)
return -ENOMEM;
- memset(newls, 0, sizeof(struct user_ls));

- newls->ls_miscinfo.name = kmalloc(namelen, GFP_KERNEL);
+ newls->ls_miscinfo.name = kzalloc(namelen, GFP_KERNEL);
if (!newls->ls_miscinfo.name) {
kfree(newls);
return -ENOMEM;
@@ -306,11 +305,10 @@
static void add_to_astqueue(struct lock_info *li, void *astaddr, void *astparam,
int lvb_updated)
{
- struct ast_info *ast = kmalloc(sizeof(struct ast_info), GFP_KERNEL);
+ struct ast_info *ast = kzalloc(sizeof(struct ast_info), GFP_KERNEL);
if (!ast)
return;

- memset(ast, 0, sizeof(*ast));
ast->result.user_astparam = astparam;
ast->result.user_astaddr = astaddr;
ast->result.user_lksb = li->li_user_lksb;
@@ -439,7 +437,7 @@
if (!lsinfo)
return -ENOENT;

- f = kmalloc(sizeof(struct file_info), GFP_KERNEL);
+ f = kzalloc(sizeof(struct file_info), GFP_KERNEL);
if (!f)
return -ENOMEM;

@@ -754,7 +752,7 @@
if (!try_module_get(THIS_MODULE))
return NULL;

- li = kmalloc(sizeof(struct lock_info), GFP_KERNEL);
+ li = kzalloc(sizeof(struct lock_info), GFP_KERNEL);
if (li) {
li->li_magic = LOCKINFO_MAGIC;
li->li_file = fi;
Index: linux/drivers/dlm/lockspace.c
===================================================================
--- linux.orig/drivers/dlm/lockspace.c 2006-01-19 10:06:23.000000000 -0600
+++ linux/drivers/dlm/lockspace.c 2006-01-19 13:38:54.848753858 -0600
@@ -351,10 +351,9 @@
return -EEXIST;
}

- ls = kmalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL);
+ ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_KERNEL);
if (!ls)
goto out;
- memset(ls, 0, sizeof(struct dlm_ls) + namelen);
memcpy(ls->ls_name, name, namelen);
ls->ls_namelen = namelen;
ls->ls_exflags = flags;
Index: linux/drivers/dlm/member.c
===================================================================
--- linux.orig/drivers/dlm/member.c 2006-01-19 13:38:44.615317587 -0600
+++ linux/drivers/dlm/member.c 2006-01-19 13:38:54.848753858 -0600
@@ -52,7 +52,7 @@
struct dlm_member *memb;
int w;

- memb = kmalloc(sizeof(struct dlm_member), GFP_KERNEL);
+ memb = kzalloc(sizeof(struct dlm_member), GFP_KERNEL);
if (!memb)
return -ENOMEM;

@@ -271,10 +271,9 @@
int *ids = NULL;
int error, count;

- rv = kmalloc(sizeof(struct dlm_recover), GFP_KERNEL);
+ rv = kzalloc(sizeof(struct dlm_recover), GFP_KERNEL);
if (!rv)
return -ENOMEM;
- memset(rv, 0, sizeof(struct dlm_recover));

error = count = dlm_nodeid_list(ls->ls_name, &ids);
if (error <= 0)