linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] CIFS: Move get_next_mid to ops struct
@ 2021-09-17 13:19 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-09-17 13:19 UTC (permalink / raw)
  To: linux-cifs

Hello Samba Devs,

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

The patch 88257360605f: "CIFS: Move get_next_mid to ops struct" from
May 23, 2012, leads to the following Smatch complaint:
        ^^^^
(nine years ago.  :P)

    fs/smbfs_client/misc.c:273 header_assemble()
    warn: variable dereferenced before check 'treeCon->ses->server' (see line 267)

fs/smbfs_client/misc.c
   251          buffer->Protocol[3] = 'B';
   252          buffer->Command = smb_command;
   253          buffer->Flags = 0x00;   /* case sensitive */
   254          buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
   255          buffer->Pid = cpu_to_le16((__u16)current->tgid);
   256          buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16));
   257          if (treeCon) {
   258                  buffer->Tid = treeCon->tid;
   259                  if (treeCon->ses) {
   260                          if (treeCon->ses->capabilities & CAP_UNICODE)
   261                                  buffer->Flags2 |= SMBFLG2_UNICODE;
   262                          if (treeCon->ses->capabilities & CAP_STATUS32)
   263                                  buffer->Flags2 |= SMBFLG2_ERR_STATUS;
   264  
   265                          /* Uid is not converted */
   266				buffer->Uid = treeCon->ses->Suid;
   267				buffer->Mid = get_next_mid(treeCon->ses->server);
                                                           ^^^^^^^^^^^^^^^^^^^^
Dereferenced

   268			}
   269			if (treeCon->Flags & SMB_SHARE_IS_IN_DFS)
   270				buffer->Flags2 |= SMBFLG2_DFS;
   271			if (treeCon->nocase)
   272				buffer->Flags  |= SMBFLG_CASELESS;
   273			if ((treeCon->ses) && (treeCon->ses->server))
                                               ^^^^^^^^^^^^^^^^^^^^
Checked too late.

   274				if (treeCon->ses->server->sign)
   275					buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-17 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 13:19 [bug report] CIFS: Move get_next_mid to ops struct Dan Carpenter

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).