All of lore.kernel.org
 help / color / mirror / Atom feed
From: bjschuma@netapp.com
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 3/3] NFS: Use kzalloc() instead of kmalloc() in the idmapper
Date: Thu,  9 Aug 2012 14:05:51 -0400	[thread overview]
Message-ID: <1344535551-4412-3-git-send-email-bjschuma@netapp.com> (raw)
In-Reply-To: <1344535551-4412-1-git-send-email-bjschuma@netapp.com>

From: Bryan Schumaker <bjschuma@netapp.com>

This will allocate memory that has already been zeroed, allowing us to
remove the memset later on.

Signed-off-by: Bryan Schumaker <bjchuma@netapp.com>
---
 fs/nfs/idmap.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 9864b48..4af524e 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -626,9 +626,6 @@ static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap,
 	substring_t substr;
 	int token, ret;
 
-	memset(im,  0, sizeof(*im));
-	memset(msg, 0, sizeof(*msg));
-
 	im->im_type = IDMAP_TYPE_GROUP;
 	im->im_private = idmap;
 	token = match_token(desc, nfs_idmap_tokens, &substr);
@@ -671,11 +668,11 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
 	int ret = -ENOMEM;
 
 	/* msg and im are freed in idmap_pipe_destroy_msg */
-	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
+	msg = kzalloc(sizeof(*msg), GFP_KERNEL);
 	if (!msg)
 		goto out0;
 
-	im = kmalloc(sizeof(*im), GFP_KERNEL);
+	im = kzalloc(sizeof(*im), GFP_KERNEL);
 	if (!im)
 		goto out1;
 
-- 
1.7.11.4


  parent reply	other threads:[~2012-08-09 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 18:05 [PATCH 1/3] NFS: Clear key construction data if the idmap upcall fails bjschuma
2012-08-09 18:05 ` [PATCH 2/3] NFS: return -ENOKEY when the upcall fails to map the name bjschuma
2012-08-10 10:10   ` William Dauchy
2012-08-10 11:04   ` William Dauchy
2012-08-09 18:05 ` bjschuma [this message]
2012-08-10 10:10   ` [PATCH 3/3] NFS: Use kzalloc() instead of kmalloc() in the idmapper William Dauchy
2012-08-10 16:16     ` Myklebust, Trond
2012-08-12 17:48       ` William Dauchy
2012-08-10 10:09 ` [PATCH 1/3] NFS: Clear key construction data if the idmap upcall fails William Dauchy
2012-08-16 13:45   ` William Dauchy
2012-08-16 15:07     ` William Dauchy
2012-08-16 15:21       ` Bryan Schumaker
2012-08-16 15:34         ` William Dauchy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1344535551-4412-3-git-send-email-bjschuma@netapp.com \
    --to=bjschuma@netapp.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.