ocfs2: cleanup dead code in ocfs2_acl_from_xattr()
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.
Signed-off-by Joseph Qi <[email protected]>
--- fs/ocfs2/acl.c | 4 ---- 1 file changed, 4 deletions(-)
fs/ocfs2/acl.c +0 -4
@@ -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
Joel Becker
maintainerPATCH 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 thansizeof(struct posix_acl_entry), it returnsERR_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.Signed-off-by Joseph Qi <[email protected]>
Acked-by Joel Becker <[email protected]>
Quoted 22 lines
--- fs/ocfs2/acl.c | 4 ---- 1 file changed, 4 deletions(-)fs/ocfs2/acl.c +0
-4@@ -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