All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: don't null-terminate xattr values
@ 2012-02-29  3:12 Alex Elder
  2012-03-02 19:27 ` Sage Weil
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2012-02-29  3:12 UTC (permalink / raw)
  To: ceph-devel

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>
---
  fs/ceph/xattr.c |    4 +---
  1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 9e6734e..b98b91d 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);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-02 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-29  3:12 [PATCH] ceph: don't null-terminate xattr values Alex Elder
2012-03-02 19:27 ` Sage Weil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.