From f7f7c1850eb98da758731ea7edfa830ebefe24cd Mon Sep 17 00:00:00 2001 From: Silviu-Mihai Popescu Date: Mon, 11 Mar 2013 18:22:32 +0200 Subject: fs: cifs: use kmemdup instead of kmalloc + memcpy This replaces calls to kmalloc followed by memcpy with a single call to kmemdup. This was found via make coccicheck. Signed-off-by: Silviu-Mihai Popescu Signed-off-by: Steve French Signed-off-by: Steve French --- fs/cifs/cifs_spnego.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/cifs/cifs_spnego.c') diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 10e774761299..b7ae3cb55549 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c @@ -37,12 +37,11 @@ cifs_spnego_key_instantiate(struct key *key, struct key_preparsed_payload *prep) int ret; ret = -ENOMEM; - payload = kmalloc(prep->datalen, GFP_KERNEL); + payload = kmemdup(prep->data, prep->datalen, GFP_KERNEL); if (!payload) goto error; /* attach the data */ - memcpy(payload, prep->data, prep->datalen); key->payload.data = payload; ret = 0; -- cgit v1.2.3