ceph: don't null-terminate xattr values
PATCH 1/1 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 <[email protected]>
--- fs/ceph/xattr.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
fs/ceph/xattr.c +1 -3
@@ -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 );
Signature · 1 line
1.7.5.4
Reviewed-by Sage Weil <[email protected]>
Quoted 36 lines · Alex Elder
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 <[email protected]>--- fs/ceph/xattr.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)fs/ceph/xattr.c +1
-3@@ -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);Signature · 6 lines
1.7.5.4 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html