linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: seth.forshee@canonical.com
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] fuse: Add posix ACL support
Date: Tue, 21 Feb 2017 21:14:46 +0300	[thread overview]
Message-ID: <20170221181446.GA27766@mwanda> (raw)

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

             reply	other threads:[~2017-02-21 18:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 18:14 Dan Carpenter [this message]
2017-02-21 18:30 ` [bug report] fuse: Add posix ACL support 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170221181446.GA27766@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=seth.forshee@canonical.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).