All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] fuse: Add posix ACL support
@ 2017-02-21 18:14 Dan Carpenter
  2017-02-21 18:30 ` Seth Forshee
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2017-02-21 18:14 UTC (permalink / raw)
  To: seth.forshee; +Cc: linux-fsdevel

Hello Seth Forshee,

The patch 60bcc88ad185: "fuse: Add posix ACL support" from Aug 29,
2016, leads to the following static checker warning:

	fs/fuse/acl.c:39 fuse_get_acl()
	warn: we tested 'fc->no_getxattr' before and it was 'false'

fs/fuse/acl.c
    13  
    14  struct posix_acl *fuse_get_acl(struct inode *inode, int type)
    15  {
    16          struct fuse_conn *fc = get_fuse_conn(inode);
    17          int size;
    18          const char *name;
    19          void *value = NULL;
    20          struct posix_acl *acl;
    21  
    22          if (!fc->posix_acl || fc->no_getxattr)
                                      ^^^^^^^^^^^^^^^

If this is set we return NULL.

    23                  return NULL;
    24  
    25          if (type == ACL_TYPE_ACCESS)
    26                  name = XATTR_NAME_POSIX_ACL_ACCESS;
    27          else if (type == ACL_TYPE_DEFAULT)
    28                  name = XATTR_NAME_POSIX_ACL_DEFAULT;
    29          else
    30                  return ERR_PTR(-EOPNOTSUPP);
    31  
    32          value = kmalloc(PAGE_SIZE, GFP_KERNEL);
    33          if (!value)
    34                  return ERR_PTR(-ENOMEM);
    35          size = fuse_getxattr(inode, name, value, PAGE_SIZE);
    36          if (size > 0)
    37                  acl = posix_acl_from_xattr(&init_user_ns, value, size);
    38          else if ((size == 0) || (size == -ENODATA) ||
    39                   (size == -EOPNOTSUPP && fc->no_getxattr))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So this can't happen.

    40                  acl = NULL;
    41          else if (size == -ERANGE)
    42                  acl = ERR_PTR(-E2BIG);
    43          else
    44                  acl = ERR_PTR(size);
    45  
    46          kfree(value);
    47          return acl;
    48  }

regards,
dan carpenter

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

* Re: [bug report] fuse: Add posix ACL support
  2017-02-21 18:14 [bug report] fuse: Add posix ACL support Dan Carpenter
@ 2017-02-21 18:30 ` Seth Forshee
  2017-02-22 14:15   ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Seth Forshee @ 2017-02-21 18:30 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-fsdevel

On Tue, Feb 21, 2017 at 09:14:46PM +0300, Dan Carpenter wrote:
> Hello Seth Forshee,
> 
> The patch 60bcc88ad185: "fuse: Add posix ACL support" from Aug 29,
> 2016, leads to the following static checker warning:

This was reported once before and is a false positive. See
http://www.spinics.net/lists/linux-fsdevel/msg103363.html.

Thanks,
Seth

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

* Re: [bug report] fuse: Add posix ACL support
  2017-02-21 18:30 ` Seth Forshee
@ 2017-02-22 14:15   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-02-22 14:15 UTC (permalink / raw)
  To: Seth Forshee; +Cc: linux-fsdevel

On Tue, Feb 21, 2017 at 12:30:18PM -0600, Seth Forshee wrote:
> On Tue, Feb 21, 2017 at 09:14:46PM +0300, Dan Carpenter wrote:
> > Hello Seth Forshee,
> > 
> > The patch 60bcc88ad185: "fuse: Add posix ACL support" from Aug 29,
> > 2016, leads to the following static checker warning:
> 
> This was reported once before and is a false positive. See
> http://www.spinics.net/lists/linux-fsdevel/msg103363.html.
> 

Wow...  That's embarrassing.  I try to check that I haven't sent them
before normally...  :/

regards,
dan carpenter

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

* Re: [bug report] fuse: Add posix ACL support
  2016-10-26  2:37 ` Seth Forshee
@ 2016-10-26  8:30   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-10-26  8:30 UTC (permalink / raw)
  To: Seth Forshee; +Cc: linux-fsdevel

On Tue, Oct 25, 2016 at 09:37:21PM -0500, Seth Forshee wrote:
> 
> This analysis is incorrect. fc->no_getxattr may be set by the
> fuse_getxattr() call above.
> 

You're right, of course.  I can see where the static checker messed up
but I also read this myself and somehow got lost...  Sorry for the
noise.

regards,
dan carpenter


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

* Re: [bug report] fuse: Add posix ACL support
  2016-10-25 21:31 Dan Carpenter
@ 2016-10-26  2:37 ` Seth Forshee
  2016-10-26  8:30   ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Seth Forshee @ 2016-10-26  2:37 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-fsdevel

On Wed, Oct 26, 2016 at 12:31:03AM +0300, Dan Carpenter wrote:
> Hello Seth Forshee,
> 
> The patch 60bcc88ad185: "fuse: Add posix ACL support" from Aug 29,
> 2016, leads to the following static checker warning:
> 
> 	fs/fuse/acl.c:39 fuse_get_acl()
> 	warn: we tested 'fc->no_getxattr' before and it was 'false'
> 
> fs/fuse/acl.c
>     14  struct posix_acl *fuse_get_acl(struct inode *inode, int type)
>     15  {
>     16          struct fuse_conn *fc = get_fuse_conn(inode);
>     17          int size;
>     18          const char *name;
>     19          void *value = NULL;
>     20          struct posix_acl *acl;
>     21  
>     22          if (!fc->posix_acl || fc->no_getxattr)
> 
> If "fc->no_getxattr" is set then we return NULL.
> 
>     23                  return NULL;
>     24  
>     25          if (type == ACL_TYPE_ACCESS)
>     26                  name = XATTR_NAME_POSIX_ACL_ACCESS;
>     27          else if (type == ACL_TYPE_DEFAULT)
>     28                  name = XATTR_NAME_POSIX_ACL_DEFAULT;
>     29          else
>     30                  return ERR_PTR(-EOPNOTSUPP);
>     31  
>     32          value = kmalloc(PAGE_SIZE, GFP_KERNEL);
>     33          if (!value)
>     34                  return ERR_PTR(-ENOMEM);
>     35          size = fuse_getxattr(inode, name, value, PAGE_SIZE);
>     36          if (size > 0)
>     37                  acl = posix_acl_from_xattr(&init_user_ns, value, size);
>     38          else if ((size == 0) || (size == -ENODATA) ||
>     39                   (size == -EOPNOTSUPP && fc->no_getxattr))
>                                                  ^^^^^^^^^^^^^^^
> So we can't actually reach here.

This analysis is incorrect. fc->no_getxattr may be set by the
fuse_getxattr() call above.

Thanks,
Seth

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

* [bug report] fuse: Add posix ACL support
@ 2016-10-25 21:31 Dan Carpenter
  2016-10-26  2:37 ` Seth Forshee
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2016-10-25 21:31 UTC (permalink / raw)
  To: seth.forshee; +Cc: linux-fsdevel

Hello Seth Forshee,

The patch 60bcc88ad185: "fuse: Add posix ACL support" from Aug 29,
2016, leads to the following static checker warning:

	fs/fuse/acl.c:39 fuse_get_acl()
	warn: we tested 'fc->no_getxattr' before and it was 'false'

fs/fuse/acl.c
    14  struct posix_acl *fuse_get_acl(struct inode *inode, int type)
    15  {
    16          struct fuse_conn *fc = get_fuse_conn(inode);
    17          int size;
    18          const char *name;
    19          void *value = NULL;
    20          struct posix_acl *acl;
    21  
    22          if (!fc->posix_acl || fc->no_getxattr)

If "fc->no_getxattr" is set then we return NULL.

    23                  return NULL;
    24  
    25          if (type == ACL_TYPE_ACCESS)
    26                  name = XATTR_NAME_POSIX_ACL_ACCESS;
    27          else if (type == ACL_TYPE_DEFAULT)
    28                  name = XATTR_NAME_POSIX_ACL_DEFAULT;
    29          else
    30                  return ERR_PTR(-EOPNOTSUPP);
    31  
    32          value = kmalloc(PAGE_SIZE, GFP_KERNEL);
    33          if (!value)
    34                  return ERR_PTR(-ENOMEM);
    35          size = fuse_getxattr(inode, name, value, PAGE_SIZE);
    36          if (size > 0)
    37                  acl = posix_acl_from_xattr(&init_user_ns, value, size);
    38          else if ((size == 0) || (size == -ENODATA) ||
    39                   (size == -EOPNOTSUPP && fc->no_getxattr))
                                                 ^^^^^^^^^^^^^^^
So we can't actually reach here.

    40                  acl = NULL;
    41          else if (size == -ERANGE)
    42                  acl = ERR_PTR(-E2BIG);
    43          else
    44                  acl = ERR_PTR(size);

regards,
dan carpenter

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

end of thread, other threads:[~2017-02-22 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21 18:14 [bug report] fuse: Add posix ACL support Dan Carpenter
2017-02-21 18:30 ` Seth Forshee
2017-02-22 14:15   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-10-25 21:31 Dan Carpenter
2016-10-26  2:37 ` Seth Forshee
2016-10-26  8:30   ` Dan Carpenter

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.