[Ocfs2-devel] [patch 11/22] ocfs2: clean up dead code in ocfs2_acl_from_xattr()

akpm at linux-foundation.org akpm at linux-foundation.org
Tue Aug 27 14:05:04 PDT 2013


From: Joseph Qi <joseph.qi at huawei.com>
Subject: ocfs2: clean up 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 <joseph.qi at huawei.com>
Cc: Mark Fasheh <mfasheh at suse.com>
Acked-by: Joel Becker <jlbec at evilplan.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 fs/ocfs2/acl.c |    4 ----
 1 file changed, 4 deletions(-)

diff -puN fs/ocfs2/acl.c~ocfs2-clean-up-dead-code-in-ocfs2_acl_from_xattr fs/ocfs2/acl.c
--- a/fs/ocfs2/acl.c~ocfs2-clean-up-dead-code-in-ocfs2_acl_from_xattr
+++ a/fs/ocfs2/acl.c
@@ -51,10 +51,6 @@ static struct posix_acl *ocfs2_acl_from_
 		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)
_



More information about the Ocfs2-devel mailing list