Skip to content

Commit

Permalink
NFS: Use kzalloc() instead of kmalloc() in the idmapper
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Bryan Schumaker authored and Trond Myklebust committed Oct 1, 2012
1 parent 6938867 commit 57a5104
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions fs/nfs/idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,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;
token = match_token(desc, nfs_idmap_tokens, &substr);

Expand Down Expand Up @@ -677,7 +674,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
int ret = -ENOMEM;

/* msg and im are freed in idmap_pipe_destroy_msg */
data = kmalloc(sizeof(*data), GFP_KERNEL);
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
goto out1;

Expand Down

0 comments on commit 57a5104

Please sign in to comment.