[Yaffs] [PATCH] yaffs: fix getxattr support

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Stephen Smalley
Date:  
To: yaffs
Subject: [Yaffs] [PATCH] yaffs: fix getxattr support
When passed a buffer size of 0, getxattr(2) is documented to return the
size of the attribute value. However, yaffs returns -ERANGE instead.
This breaks e.g. SELinux usage of getxattr. Fix yaffs to return the
attribute size in this case.

Signed-off-by: Stephen Smalley <>

---

 yaffs_nameval.c |    3 +++
 1 file changed, 3 insertions(+)


diff --git a/yaffs_nameval.c b/yaffs_nameval.c
index e75411b..727b644 100644
--- a/yaffs_nameval.c
+++ b/yaffs_nameval.c
@@ -146,6 +146,9 @@ int nval_get(const char *xb, int xb_size, const
YCHAR * name, char *buf,
         pos++;
         size--;


+        if (!bsize)
+            return size;
+
         if (size <= bsize) {
             memcpy(buf, xb + pos, size);
             return size;


--
Stephen Smalley
National Security Agency