All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: cleanup dead code in ocfs2_acl_from_xattr()
@ 2013-07-30  8:58 Joseph Qi
  2013-08-01  7:22 ` Joel Becker
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Qi @ 2013-07-30  8:58 UTC (permalink / raw)
  To: ocfs2-devel

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@huawei.com>
---
 fs/ocfs2/acl.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 8a40457..b4f788e 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -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)
-- 
1.7.9.7

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

* [Ocfs2-devel] [PATCH] ocfs2: cleanup dead code in ocfs2_acl_from_xattr()
  2013-07-30  8:58 [Ocfs2-devel] [PATCH] ocfs2: cleanup dead code in ocfs2_acl_from_xattr() Joseph Qi
@ 2013-08-01  7:22 ` Joel Becker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Becker @ 2013-08-01  7:22 UTC (permalink / raw)
  To: ocfs2-devel

On Tue, Jul 30, 2013 at 04:58:22PM +0800, Joseph Qi wrote:
> 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@huawei.com>

Acked-by: Joel Becker <jlbec@evilplan.org>

> ---
>  fs/ocfs2/acl.c |    4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
> index 8a40457..b4f788e 100644
> --- a/fs/ocfs2/acl.c
> +++ b/fs/ocfs2/acl.c
> @@ -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)
> -- 
> 1.7.9.7
> 

-- 

Life's Little Instruction Book #347

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

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

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

end of thread, other threads:[~2013-08-01  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-30  8:58 [Ocfs2-devel] [PATCH] ocfs2: cleanup dead code in ocfs2_acl_from_xattr() Joseph Qi
2013-08-01  7:22 ` Joel Becker

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.