summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-01-23 15:49:27 -0600
committerAlex Elder <elder@dreamhost.com>2012-03-22 10:47:46 -0500
commitb829c1954dbeb42a1277a8cb05943050ee70be94 (patch)
tree661cb42188119da359b1850117a36a1fcf319063 /fs/ceph
parent99f0f3b2c4be15784bb4ede33b5f2c3f7861dba7 (diff)
ceph: don't null-terminate xattr values
For some reason, ceph_setxattr() allocates an extra byte in which a '\0' is stored past the end of an extended attribute value. This is not needed, and is potentially misleading, so get rid of it. Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/xattr.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index a76f697303d..bfff735091f 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -730,11 +730,9 @@ int ceph_setxattr(struct dentry *dentry, const char *name,
goto out;
if (val_len) {
- newval = kmalloc(val_len + 1, GFP_NOFS);
+ newval = kmemdup(value, val_len, GFP_NOFS);
if (!newval)
goto out;
- memcpy(newval, value, val_len);
- newval[val_len] = '\0';
}
xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS);