Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: brauner@kernel.org
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] cifs: implement set acl method
Date: Fri, 28 Oct 2022 13:38:29 +0300	[thread overview]
Message-ID: <Y1uxJVwln0+gTaFz@kili> (raw)

Hello Christian Brauner,

This is a semi-automatic email about new static checker warnings.

The patch dc1af4c4b472: "cifs: implement set acl method" from Sep 22,
2022, leads to the following Smatch complaint:

    fs/cifs/cifsacl.c:1781 cifs_set_acl()
    warn: variable dereferenced before check 'acl' (see line 1773)

fs/cifs/cifsacl.c
  1772			returns as xattrs */
  1773		if (posix_acl_xattr_size(acl->a_count) > CIFSMaxBufSize) {
                                         ^^^
I looked at the callers and "acl" can definitely be NULL at this point.
I feel like it would be nice to check it earlier and goto out directly,
but I don't know what a NULL acl is for...

  1774			cifs_dbg(FYI, "size of EA value too large\n");
  1775			rc = -EOPNOTSUPP;
  1776			goto out;
  1777		}
  1778	
  1779		switch (type) {
  1780		case ACL_TYPE_ACCESS:
  1781			if (!acl)
                            ^^^^
Too late.  And later on there is another check as well.

  1782				goto out;
  1783			if (sb->s_flags & SB_POSIXACL)

regards,
dan carpenter

             reply	other threads:[~2022-10-28 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 10:38 Dan Carpenter [this message]
2022-10-28 10:49 ` [bug report] cifs: implement set acl method Christian Brauner
2022-10-28 10:52   ` 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=Y1uxJVwln0+gTaFz@kili \
    --to=dan.carpenter@oracle.com \
    --cc=brauner@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    /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