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 <[email protected]>
---

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-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to