All of lore.kernel.org
 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:35:00 +0300	[thread overview]
Message-ID: <20191001083500.GA20393@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:2528 SMB2_open_init()
	warn: always true condition '(oparms->mode != -1) => (0-u16max != (-1))'

fs/cifs/smb2pdu.c
  2510          if (tcon->snapshot_time) {
  2511                  cifs_dbg(FYI, "adding snapshot context\n");
  2512                  if (n_iov > 2) {
  2513                          struct create_context *ccontext =
  2514                              (struct create_context *)iov[n_iov-1].iov_base;
  2515                          ccontext->Next =
  2516                                  cpu_to_le32(iov[n_iov-1].iov_len);
  2517                  }
  2518  
  2519                  rc = add_twarp_context(iov, &n_iov, tcon->snapshot_time);
  2520                  if (rc)
  2521                          return rc;
  2522          }
  2523  
  2524          /* TODO: add handling for the mode on create */
  2525          if (oparms->disposition == FILE_CREATE)
  2526                  cifs_dbg(VFS, "mode is 0x%x\n", oparms->mode); /* BB REMOVEME */
  2527  
  2528          if ((oparms->disposition == FILE_CREATE) && (oparms->mode != -1)) {
                                                             ^^^^^^^^^^^^^^^^^^
unsigned short can't equal -1.

  2529                  if (n_iov > 2) {
  2530                          struct create_context *ccontext =
  2531                              (struct create_context *)iov[n_iov-1].iov_base;
  2532                          ccontext->Next =
  2533                                  cpu_to_le32(iov[n_iov-1].iov_len);
  2534                  }
  2535  
  2536                  /* rc = add_sd_context(iov, &n_iov, oparms->mode); */
  2537                  if (rc)
  2538                          return rc;
  2539          }
  2540  
  2541          if (n_iov > 2) {
  2542                  struct create_context *ccontext =
  2543                          (struct create_context *)iov[n_iov-1].iov_base;
  2544                  ccontext->Next = cpu_to_le32(iov[n_iov-1].iov_len);
  2545          }

regards,
dan carpenter

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01  8:35 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-10-01  8:21 [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=20191001083500.GA20393@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 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.