diff mbox

[2/3] fs/ceph/xattr.c: Use kmemdup

Message ID Pine.LNX.4.64.1010172154400.394@ask.diku.dk (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lawall Oct. 17, 2010, 7:55 p.m. UTC
None
diff mbox

Patch

diff -u -p a/fs/ceph/xattr.c b/fs/ceph/xattr.c
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -716,10 +716,9 @@  int ceph_setxattr(struct dentry *dentry,
 
 	/* preallocate memory for xattr name, value, index node */
 	err = -ENOMEM;
-	newname = kmalloc(name_len + 1, GFP_NOFS);
+	newname = kmemdup(name, name_len + 1, GFP_NOFS);
 	if (!newname)
 		goto out;
-	memcpy(newname, name, name_len + 1);
 
 	if (val_len) {
 		newval = kmalloc(val_len + 1, GFP_NOFS);