Skip to content

Commit b829c19

Browse files
author
Alex Elder
committed
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>
1 parent 99f0f3b commit b829c19

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎fs/ceph/xattr.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,9 @@ int ceph_setxattr(struct dentry *dentry, const char *name,
730730
goto out;
731731

732732
if (val_len) {
733-
newval = kmalloc(val_len + 1, GFP_NOFS);
733+
newval = kmemdup(value, val_len, GFP_NOFS);
734734
if (!newval)
735735
goto out;
736-
memcpy(newval, value, val_len);
737-
newval[val_len] = '\0';
738736
}
739737

740738
xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS);

0 commit comments

Comments
 (0)