diff mbox

[3/3] NFS: Use kzalloc() instead of kmalloc() in the idmapper

Message ID 1344535551-4412-3-git-send-email-bjschuma@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bryan Schumaker Aug. 9, 2012, 6:05 p.m. UTC
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(-)

Comments

William Dauchy Aug. 10, 2012, 10:10 a.m. UTC | #1
On Thu, Aug 9, 2012 at 8:05 PM,  <bjschuma@netapp.com> wrote:
> 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>

Tested-by: William Dauchy <wdauchy@gmail.com>
Cc: stable@vger.kernel.org
Trond Myklebust Aug. 10, 2012, 4:16 p.m. UTC | #2
On Fri, 2012-08-10 at 12:10 +0200, William Dauchy wrote:
> On Thu, Aug 9, 2012 at 8:05 PM,  <bjschuma@netapp.com> wrote:

> > 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>

> 

> Tested-by: William Dauchy <wdauchy@gmail.com>

> Cc: stable@vger.kernel.org

> 


No. This is a cleanup and so is not stable kernel material.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
William Dauchy Aug. 12, 2012, 5:48 p.m. UTC | #3
On Fri, Aug 10, 2012 at 6:16 PM, Myklebust, Trond
<Trond.Myklebust@netapp.com> wrote:
> No. This is a cleanup and so is not stable kernel material.

true; sorry for the glitch
diff mbox

Patch

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;