Commit b829c195 authored by Alex Elder's avatar Alex Elder

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: default avatarAlex Elder <elder@dreamhost.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 99f0f3b2
...@@ -730,11 +730,9 @@ int ceph_setxattr(struct dentry *dentry, const char *name, ...@@ -730,11 +730,9 @@ int ceph_setxattr(struct dentry *dentry, const char *name,
goto out; goto out;
if (val_len) { if (val_len) {
newval = kmalloc(val_len + 1, GFP_NOFS); newval = kmemdup(value, val_len, GFP_NOFS);
if (!newval) if (!newval)
goto out; goto out;
memcpy(newval, value, val_len);
newval[val_len] = '\0';
} }
xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS); xattr = kmalloc(sizeof(struct ceph_inode_xattr), GFP_NOFS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment