Skip to contentSkip to conversation

kzalloc conversion in fs/lockd

PATCH New Eric Sesterhenn 1 participant 1 message Feb 22, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kzalloc conversion in fs/lockd

hi,

this converts fs/lockd to kzalloc() usage.
compile tested with make allyesconfig

fs/lockd/clntproc.c renamed from fs/lockd/clntproc.c.orig +1 -2
@@ -292,9 +292,8 @@ nlmclnt_alloc_call(void)
 	struct nlm_rqst	*call;
 
 	while (!signalled()) {
-		call = (struct nlm_rqst *) kmalloc(sizeof(struct nlm_rqst), GFP_KERNEL);
+		call = (struct nlm_rqst *) kzalloc(sizeof(struct nlm_rqst), GFP_KERNEL);
 		if (call) {
-			memset(call, 0, sizeof(*call));
 			locks_init_lock(&call->a_args.lock.fl);
 			locks_init_lock(&call->a_res.lock.fl);
 			return call;
fs/lockd/host.c renamed from fs/lockd/host.c.orig +1 -2
@@ -99,9 +99,8 @@ nlm_lookup_host(int server, struct socka
 	/* Ooops, no host found, create it */
 	dprintk("lockd: creating host entry\n");
 
-	if (!(host = (struct nlm_host *) kmalloc(sizeof(*host), GFP_KERNEL)))
+	if (!(host = (struct nlm_host *) kzalloc(sizeof(*host), GFP_KERNEL)))
 		goto nohost;
-	memset(host, 0, sizeof(*host));
 
 	addr = sin->sin_addr.s_addr;
 	sprintf(host->h_name, "%u.%u.%u.%u", NIPQUAD(addr));
fs/lockd/svclock.c renamed from fs/lockd/svclock.c.orig +1 -2
@@ -183,9 +183,8 @@ nlmsvc_create_block(struct svc_rqst *rqs
 		return NULL;
 
 	/* Allocate memory for block, and initialize arguments */
-	if (!(block = (struct nlm_block *) kmalloc(sizeof(*block), GFP_KERNEL)))
+	if (!(block = (struct nlm_block *) kzalloc(sizeof(*block), GFP_KERNEL)))
 		goto failed;
-	memset(block, 0, sizeof(*block));
 	locks_init_lock(&block->b_call.a_args.lock.fl);
 	locks_init_lock(&block->b_call.a_res.lock.fl);
 
fs/lockd/svcsubs.c renamed from fs/lockd/svcsubs.c.orig +1 -2
@@ -100,11 +100,10 @@ nlm_lookup_file(struct svc_rqst *rqstp, 
 	nlm_debug_print_fh("creating file for", f);
 
 	nfserr = nlm_lck_denied_nolocks;
-	file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
+	file = (struct nlm_file *) kzalloc(sizeof(*file), GFP_KERNEL);
 	if (!file)
 		goto out_unlock;
 
-	memset(file, 0, sizeof(*file));
 	memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
 	file->f_hash = hash;
 	init_MUTEX(&file->f_sema);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors