[bug report] smb3: pass mode bits into create calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux