linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: stfrench@microsoft.com
Cc: linux-cifs@vger.kernel.org
Subject: [bug report] smb3: pass mode bits into create calls
Date: Tue, 1 Oct 2019 11:21:52 +0300	[thread overview]
Message-ID: <20191001082152.GA26699@mwanda> (raw)

Hello Steve French,

The patch c3ca78e21744: "smb3: pass mode bits into create calls" from
Sep 25, 2019, leads to the following static checker warning:

	fs/cifs/smb2pdu.c:754 add_posix_context()
	warn: impossible condition '(mode == -1) => (0-u16max == (-1))'

fs/cifs/smb2pdu.c
   747  static int
   748  add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode)
                                                                     ^^^^^^^
This is unsigned short.

   749  {
   750          struct smb2_create_req *req = iov[0].iov_base;
   751          unsigned int num = *num_iovec;
   752  
   753          iov[num].iov_base = create_posix_buf(mode);
   754          if (mode == -1)
                    ^^^^^^^^^^
So this debug code will never trigger.

   755                  cifs_dbg(VFS, "illegal mode\n"); /* BB REMOVEME */
   756          if (iov[num].iov_base == NULL)
   757                  return -ENOMEM;
   758          iov[num].iov_len = sizeof(struct create_posix);
   759          if (!req->CreateContextsOffset)
   760                  req->CreateContextsOffset = cpu_to_le32(
   761                                  sizeof(struct smb2_create_req) +
   762                                  iov[num - 1].iov_len);
   763          le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_posix));
   764          *num_iovec = num + 1;
   765          return 0;
   766  }

regards,
dan carpenter

             reply	other threads:[~2019-10-01  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01  8:21 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-01  8:35 [bug report] smb3: pass mode bits into create calls 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=20191001082152.GA26699@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=stfrench@microsoft.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).