linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: Use kmemdup rather than duplicating its implementation
@ 2011-11-12  9:22 Thomas Meyer
  0 siblings, 0 replies; only message in thread
From: Thomas Meyer @ 2011-11-12  9:22 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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-VsYtu1Qij5c@public.gmane.org>
---

diff -u -p a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
--- a/fs/cifs/cifs_spnego.c 2011-11-07 19:38:22.023802738 +0100
+++ b/fs/cifs/cifs_spnego.c 2011-11-08 10:34:14.586074433 +0100
@@ -37,12 +37,11 @@ cifs_spnego_key_instantiate(struct key *
 	int ret;
 
 	ret = -ENOMEM;
-	payload = kmalloc(datalen, GFP_KERNEL);
+	payload = kmemdup(data, datalen, GFP_KERNEL);
 	if (!payload)
 		goto error;
 
 	/* attach the data */
-	memcpy(payload, data, datalen);
 	key->payload.data = payload;
 	ret = 0;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-12  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-12  9:22 [PATCH] cifs: Use kmemdup rather than duplicating its implementation Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).