[PATCH] cifs: Use kmemdup rather than duplicating its implementation

From: Thomas Meyer
Date: Sat Nov 12 2011 - 04:22:44 EST


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@xxxxxxxx>
---

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;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/