[bug report] CIFS: Move get_next_mid to ops struct

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

 



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



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

  Powered by Linux