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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux