Skip to contentSkip to conversation

ocfs2: cleanup dead code in ocfs2_acl_from_xattr()

PATCH New Joseph Qi 2 participants 2 messages Jul 30, 2013 – Aug 1, 2013 OCFS2

lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

PATCH 1/1 ocfs2: cleanup dead code in ocfs2_acl_from_xattr()

In ocfs2_acl_from_xattr(), if size is less than sizeof(struct posix_acl_entry), it returns ERR_PTR(-EINVAL) directly. Then assign (size / sizeof(struct posix_acl_entry)) to count which will be at least 1, that means the following branch (count < 0) and (count == 0) will never be true.

---
 fs/ocfs2/acl.c |    4 ----
 1 file changed, 4 deletions(-)
fs/ocfs2/acl.c +0 -4
index 8a40457..b4f788e 100644
@@ -51,10 +51,6 @@ static struct posix_acl *ocfs2_acl_from_xattr(const void *value, size_t size)
 		return ERR_PTR(-EINVAL);
 
 	count = size / sizeof(struct posix_acl_entry);
-	if (count < 0)
-		return ERR_PTR(-EINVAL);
-	if (count == 0)
-		return NULL;
 
 	acl = posix_acl_alloc(count, GFP_NOFS);
 	if (!acl)
Signature · 1 line
1.7.9.7
maintainer
#1 lore raw

PATCH 1/1 ocfs2: cleanup dead code in ocfs2_acl_from_xattr()

Quoted 7 lines · Joseph Qi

In ocfs2_acl_from_xattr(), if size is less than sizeof(struct posix_acl_entry), it returns ERR_PTR(-EINVAL) directly. Then assign (size / sizeof(struct posix_acl_entry)) to count which will be at least 1, that means the following branch (count < 0) and (count == 0) will never be true.

Quoted 22 lines
---
 fs/ocfs2/acl.c |    4 ----
 1 file changed, 4 deletions(-)
fs/ocfs2/acl.c +0 -4
index 8a40457..b4f788e 100644
@@ -51,10 +51,6 @@ static struct posix_acl *ocfs2_acl_from_xattr(const void *value, size_t size)
 		return ERR_PTR(-EINVAL);
 
 	count = size / sizeof(struct posix_acl_entry);
-	if (count < 0)
-		return ERR_PTR(-EINVAL);
-	if (count == 0)
-		return NULL;
 
 	acl = posix_acl_alloc(count, GFP_NOFS);
 	if (!acl)
Signature · 1 line
1.7.9.7
Signature · 6 lines
Life's Little Instruction Book #347

	"Never waste the oppourtunity to tell someone you love them."

			http://www.jlbec.org/
			jlbec at evilplan.org