summaryrefslogtreecommitdiff
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2011-11-18 02:43:40 +0400
committerJ. Bruce Fields <bfields@redhat.com>2011-11-26 03:44:22 +0400
commit67114fe6103183190fb0a24f58e5695a80beb2ec (patch)
tree65696c5d33a37acf7af71a5fd6bab0f9c0c155fe /fs/nfsd/nfs4xdr.c
parent009673b439cf74d70a486fca0177e274febd81a7 (diff)
downloadlinux-67114fe6103183190fb0a24f58e5695a80beb2ec.tar.xz
nfsd4: Use kmemdup rather than duplicating its implementation
The semantic patch that makes this change is available in scripts/coccinelle/api/memdup.cocci. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b6fa792d6b85..0ec5a1b9700e 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -215,10 +215,9 @@ defer_free(struct nfsd4_compoundargs *argp,
static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes)
{
if (p == argp->tmp) {
- p = kmalloc(nbytes, GFP_KERNEL);
+ p = kmemdup(argp->tmp, nbytes, GFP_KERNEL);
if (!p)
return NULL;
- memcpy(p, argp->tmp, nbytes);
} else {
BUG_ON(p != argp->tmpp);
argp->tmpp = NULL;