summaryrefslogtreecommitdiffstats
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorSilviu-Mihai Popescu <silviupopescu1990@gmail.com>2013-03-11 18:22:32 +0200
committerSteve French <smfrench@gmail.com>2013-05-04 22:08:19 -0500
commitf7f7c1850eb98da758731ea7edfa830ebefe24cd (patch)
tree78e8199747533ec4b78e27fd739ea68ebf13a171 /fs/cifs/sess.c
parentd455b72bdd23a1d7adcbdfb5c1ceabcd7beaf853 (diff)
downloadlinux-f7f7c1850eb98da758731ea7edfa830ebefe24cd.tar.bz2
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 <silviupopescu1990@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 76809f4d3428..6f83881ff30b 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -399,12 +399,12 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
return -EINVAL;
}
if (tilen) {
- ses->auth_key.response = kmalloc(tilen, GFP_KERNEL);
+ ses->auth_key.response = kmemdup(bcc_ptr + tioffset, tilen,
+ GFP_KERNEL);
if (!ses->auth_key.response) {
cERROR(1, "Challenge target info allocation failure");
return -ENOMEM;
}
- memcpy(ses->auth_key.response, bcc_ptr + tioffset, tilen);
ses->auth_key.len = tilen;
}
@@ -761,14 +761,14 @@ ssetup_ntlmssp_authenticate:
goto ssetup_exit;
}
- ses->auth_key.response = kmalloc(msg->sesskey_len, GFP_KERNEL);
+ ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len,
+ GFP_KERNEL);
if (!ses->auth_key.response) {
cERROR(1, "Kerberos can't allocate (%u bytes) memory",
msg->sesskey_len);
rc = -ENOMEM;
goto ssetup_exit;
}
- memcpy(ses->auth_key.response, msg->data, msg->sesskey_len);
ses->auth_key.len = msg->sesskey_len;
pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;