CC: [email protected]
CC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Ronnie Sahlberg <[email protected]>
CC: Steve French <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   86ed57fd8c93fdfaabb4f58e78455180fa7d8a84
commit: d3986619ac1ea40c4f4a988edd4d0c569ed5cd9c [8113/9522] cifs: move 
functions that depend on DES to smp1ops.c
:::::: branch date: 34 hours ago
:::::: commit date: 5 days ago
config: i386-randconfig-c001-20210820 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
d9c5613e856cf2addfbf892fc4c1ce9ef9feceaa)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=d3986619ac1ea40c4f4a988edd4d0c569ed5cd9c
        git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout d3986619ac1ea40c4f4a988edd4d0c569ed5cd9c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   drivers/hid/hid-steam.c:156:2: note: Returning without writing to '*data'
           return ret;
           ^
   drivers/hid/hid-steam.c:243:8: note: Returning from 'steam_recv_report'
           ret = steam_recv_report(steam, reply, sizeof(reply));
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-steam.c:244:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/hid/hid-steam.c:244:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/hid/hid-steam.c:246:15: note: The left operand of '!=' is a garbage 
value
           if (reply[0] != 0xae || reply[1] != 0x15 || reply[2] != 0x01)
               ~~~~~~~~ ^
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/w1/slaves/w1_therm.c:1252:5: warning: Value stored to 'ret' is never 
read [clang-analyzer-deadcode.DeadStores]
                                   ret = -EIO;
                                   ^     ~~~~
   drivers/w1/slaves/w1_therm.c:1252:5: note: Value stored to 'ret' is never 
read
                                   ret = -EIO;
                                   ^     ~~~~
   drivers/w1/slaves/w1_therm.c:1799:2: warning: Call to function 'strcpy' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(p_args, buf);
           ^~~~~~
   drivers/w1/slaves/w1_therm.c:1799:2: note: Call to function 'strcpy' is 
insecure as it does not provide bounding of the memory buffer. Replace 
unbounded copy functions with analogous functions that support length arguments 
such as 'strlcpy'. CWE-119
           strcpy(p_args, buf);
           ^~~~~~
   drivers/w1/slaves/w1_therm.c:2090:22: warning: The right operand of '==' is 
a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (sl->reg_num.id == reg_num->id)
                                      ^  ~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2067:6: note: Assuming the condition is false
           if (w1_reset_bus(sl->master))
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2067:2: note: Taking false branch
           if (w1_reset_bus(sl->master))
           ^
   drivers/w1/slaves/w1_therm.c:2077:6: note: Assuming 'ack' is equal to 
W1_42_SUCCESS_CONFIRM_BYTE
           if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2077:2: note: Taking false branch
           if (ack != W1_42_SUCCESS_CONFIRM_BYTE)
           ^
   drivers/w1/slaves/w1_therm.c:2081:2: note: Loop condition is true.  Entering 
loop body
           for (i = 0; i <= 64; i++) {
           ^
   drivers/w1/slaves/w1_therm.c:2082:7: note: Assuming the condition is false
                   if (w1_reset_bus(sl->master))
                       ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2082:3: note: Taking false branch
                   if (w1_reset_bus(sl->master))
                   ^
   drivers/w1/slaves/w1_therm.c:2088:7: note: Assuming field 'family' is not 
equal to W1_42_FINISHED_BYTE
                   if (reg_num->family == W1_42_FINISHED_BYTE)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/w1/slaves/w1_therm.c:2088:3: note: Taking false branch
                   if (reg_num->family == W1_42_FINISHED_BYTE)
                   ^
   drivers/w1/slaves/w1_therm.c:2090:22: note: The right operand of '==' is a 
garbage value
                   if (sl->reg_num.id == reg_num->id)
                                      ^  ~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   15 warnings generated.
   fs/cifs/cifsacl.c:1142:3: warning: Value stored to 'new_aces_set' is never 
read [clang-analyzer-deadcode.DeadStores]
                   new_aces_set = true;
                   ^              ~~~~
   fs/cifs/cifsacl.c:1142:3: note: Value stored to 'new_aces_set' is never read
                   new_aces_set = true;
                   ^              ~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   15 warnings generated.
   fs/cifs/fs_context.c:566:4: warning: Call to function 'strcpy' is insecure 
as it does not provide bounding of the memory buffer. Replace unbounded copy 
functions with analogous functions that support length arguments such as 
'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                           strcpy(key + len, options);
                           ^~~~~~
   fs/cifs/fs_context.c:566:4: note: Call to function 'strcpy' is insecure as 
it does not provide bounding of the memory buffer. Replace unbounded copy 
functions with analogous functions that support length arguments such as 
'strlcpy'. CWE-119
                           strcpy(key + len, options);
                           ^~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   14 warnings generated.
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   16 warnings generated.
>> fs/cifs/smb1ops.c:272:3: warning: Call to function 'strcpy' is insecure as 
>> it does not provide bounding of the memory buffer. Replace unbounded copy 
>> functions with analogous functions that support length arguments such as 
>> 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcpy(bcc_ptr, tree);
                   ^~~~~~
   fs/cifs/smb1ops.c:272:3: note: Call to function 'strcpy' is insecure as it 
does not provide bounding of the memory buffer. Replace unbounded copy 
functions with analogous functions that support length arguments such as 
'strlcpy'. CWE-119
                   strcpy(bcc_ptr, tree);
                   ^~~~~~
   fs/cifs/smb1ops.c:275:2: warning: Call to function 'strcpy' is insecure as 
it does not provide bounding of the memory buffer. Replace unbounded copy 
functions with analogous functions that support length arguments such as 
'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(bcc_ptr, "?????");
           ^~~~~~
   fs/cifs/smb1ops.c:275:2: note: Call to function 'strcpy' is insecure as it 
does not provide bounding of the memory buffer. Replace unbounded copy 
functions with analogous functions that support length arguments such as 
'strlcpy'. CWE-119
           strcpy(bcc_ptr, "?????");
           ^~~~~~
   Suppressed 14 warnings (14 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   Suppressed 10 warnings (10 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   include/linux/hid.h:1007:9: warning: Access to field 'name' results in a 
dereference of a null pointer (loaded from variable 'input') 
[clang-analyzer-core.NullDereference]
                                       input->name, c, type);
                                       ^
   drivers/hid/hid-topseed.c:30:6: note: Assuming the condition is false
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/hid/hid-topseed.c:30:2: note: Taking false branch
           if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
           ^
   drivers/hid/hid-topseed.c:33:2: note: Control jumps to 'case 90:'  at line 51
           switch (usage->hid & HID_USAGE) {
           ^
   drivers/hid/hid-topseed.c:51:14: note: Calling 'hid_map_usage_clear'
           case 0x05a: ts_map_key_clear(KEY_TEXT);         break;
                       ^
   drivers/hid/hid-topseed.c:24:29: note: expanded from macro 'ts_map_key_clear'
   #define ts_map_key_clear(c)     hid_map_usage_clear(hi, usage, bit, max, \
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1035:2: note: Calling 'hid_map_usage'
           hid_map_usage(hidinput, usage, bit, max, type, c);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:982:2: note: 'input' initialized here
           struct input_dev *input = hidinput->input;
           ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:986:2: note: Control jumps to 'case 1:'  at line 995
           switch (type) {
           ^
   include/linux/hid.h:998:3: note:  Execution continues on line 1005
                   break;
                   ^
   include/linux/hid.h:1005:15: note: 'c' is <= 'limit'
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:15: note: Left side of '||' is false
           if (unlikely(c > limit || !bmap)) {
                        ^
   include/linux/hid.h:1005:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:1005:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:1006:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:540:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro 
'__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:1006:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:557:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:540:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:1007:9: note: Access to field 'name' results in a 
dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);

vim +272 fs/cifs/smb1ops.c

d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  177  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  178  /*
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  179   * Issue a TREE_CONNECT request.
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  180   */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  181  static int
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  182  CIFSTCon(const unsigned int 
xid, struct cifs_ses *ses,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  183           const char *tree, 
struct cifs_tcon *tcon,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  184           const struct nls_table 
*nls_codepage)
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  185  {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  186          struct smb_hdr 
*smb_buffer;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  187          struct smb_hdr 
*smb_buffer_response;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  188          TCONX_REQ *pSMB;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  189          TCONX_RSP *pSMBr;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  190          unsigned char *bcc_ptr;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  191          int rc = 0;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  192          int length;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  193          __u16 bytes_left, count;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  194  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  195          if (ses == NULL)
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  196                  return -EIO;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  197  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  198          smb_buffer = 
cifs_buf_get();
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  199          if (smb_buffer == NULL)
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  200                  return -ENOMEM;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  201  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  202          smb_buffer_response = 
smb_buffer;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  203  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  204          
header_assemble(smb_buffer, SMB_COM_TREE_CONNECT_ANDX,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  205                          NULL 
/*no tid */ , 4 /*wct */ );
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  206  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  207          smb_buffer->Mid = 
get_next_mid(ses->server);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  208          smb_buffer->Uid = 
ses->Suid;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  209          pSMB = (TCONX_REQ *) 
smb_buffer;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  210          pSMBr = (TCONX_RSP *) 
smb_buffer_response;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  211  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  212          pSMB->AndXCommand = 
0xFF;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  213          pSMB->Flags = 
cpu_to_le16(TCON_EXTENDED_SECINFO);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  214          bcc_ptr = 
&pSMB->Password[0];
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  215          if (tcon->pipe || 
(ses->server->sec_mode & SECMODE_USER)) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  216                  
pSMB->PasswordLength = cpu_to_le16(1);  /* minimum */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  217                  *bcc_ptr = 0; 
/* password is null byte */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  218                  bcc_ptr++;      
        /* skip password */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  219                  /* already 
aligned so no need to do it below */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  220          } else {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  221                  
pSMB->PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  222                  /* BB FIXME add 
code to fail this if NTLMv2 or Kerberos
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  223                     specified as 
required (when that support is added to
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  224                     the vfs in 
the future) as only NTLM or the much
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  225                     weaker 
LANMAN (which we do not send by default) is accepted
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  226                     by Samba 
(not sure whether other servers allow
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  227                     NTLMv2 
password here) */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  228  #ifdef CONFIG_CIFS_WEAK_PW_HASH
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  229                  if 
((global_secflags & CIFSSEC_MAY_LANMAN) &&
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  230                      
(ses->sectype == LANMAN))
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  231                          
calc_lanman_hash(tcon->password, ses->server->cryptkey,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  232                                  
         ses->server->sec_mode &
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  233                                  
            SECMODE_PW_ENCRYPT ? true : false,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  234                                  
         bcc_ptr);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  235                  else
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  236  #endif /* CIFS_WEAK_PW_HASH */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  237                  rc = 
SMBNTencrypt(tcon->password, ses->server->cryptkey,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  238                                  
        bcc_ptr, nls_codepage);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  239                  if (rc) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  240                          
cifs_dbg(FYI, "%s Can't generate NTLM rsp. Error: %d\n",
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  241                                  
 __func__, rc);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  242                          
cifs_buf_release(smb_buffer);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  243                          return 
rc;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  244                  }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  245  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  246                  bcc_ptr += 
CIFS_AUTH_RESP_SIZE;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  247                  if 
(ses->capabilities & CAP_UNICODE) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  248                          /* must 
align unicode strings */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  249                          
*bcc_ptr = 0; /* null byte password */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  250                          
bcc_ptr++;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  251                  }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  252          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  253  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  254          if (ses->server->sign)
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  255                  
smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  256  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  257          if (ses->capabilities & 
CAP_STATUS32) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  258                  
smb_buffer->Flags2 |= SMBFLG2_ERR_STATUS;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  259          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  260          if (ses->capabilities & 
CAP_DFS) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  261                  
smb_buffer->Flags2 |= SMBFLG2_DFS;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  262          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  263          if (ses->capabilities & 
CAP_UNICODE) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  264                  
smb_buffer->Flags2 |= SMBFLG2_UNICODE;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  265                  length =
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  266                      
cifs_strtoUTF16((__le16 *) bcc_ptr, tree,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  267                          6 /* 
max utf8 char length in bytes */ *
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  268                          (/* 
server len*/ + 256 /* share len */), nls_codepage);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  269                  bcc_ptr += 2 * 
length;  /* convert num 16 bit words to bytes */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  270                  bcc_ptr += 2;   
/* skip trailing null */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  271          } else {                
/* ASCII */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17 @272                  strcpy(bcc_ptr, 
tree);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  273                  bcc_ptr += 
strlen(tree) + 1;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  274          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  275          strcpy(bcc_ptr, 
"?????");
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  276          bcc_ptr += 
strlen("?????");
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  277          bcc_ptr += 1;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  278          count = bcc_ptr - 
&pSMB->Password[0];
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  279          
be32_add_cpu(&pSMB->hdr.smb_buf_length, count);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  280          pSMB->ByteCount = 
cpu_to_le16(count);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  281  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  282          rc = SendReceive(xid, 
ses, smb_buffer, smb_buffer_response, &length,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  283                           0);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  284  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  285          /* above now done in 
SendReceive */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  286          if (rc == 0) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  287                  bool is_unicode;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  288  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  289                  tcon->tidStatus 
= CifsGood;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  290                  
tcon->need_reconnect = false;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  291                  tcon->tid = 
smb_buffer_response->Tid;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  292                  bcc_ptr = 
pByteArea(smb_buffer_response);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  293                  bytes_left = 
get_bcc(smb_buffer_response);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  294                  length = 
strnlen(bcc_ptr, bytes_left - 2);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  295                  if 
(smb_buffer->Flags2 & SMBFLG2_UNICODE)
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  296                          
is_unicode = true;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  297                  else
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  298                          
is_unicode = false;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  299  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  300  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  301                  /* skip service 
field (NB: this field is always ASCII) */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  302                  if (length == 
3) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  303                          if 
((bcc_ptr[0] == 'I') && (bcc_ptr[1] == 'P') &&
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  304                              
(bcc_ptr[2] == 'C')) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  305                                  
cifs_dbg(FYI, "IPC connection\n");
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  306                                  
tcon->ipc = true;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  307                                  
tcon->pipe = true;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  308                          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  309                  } else if 
(length == 2) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  310                          if 
((bcc_ptr[0] == 'A') && (bcc_ptr[1] == ':')) {
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  311                                  
/* the most common case */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  312                                  
cifs_dbg(FYI, "disk share connection\n");
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  313                          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  314                  }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  315                  bcc_ptr += 
length + 1;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  316                  bytes_left -= 
(length + 1);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  317                  
strlcpy(tcon->treeName, tree, sizeof(tcon->treeName));
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  318  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  319                  /* mostly 
informational -- no need to fail on error here */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  320                  
kfree(tcon->nativeFileSystem);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  321                  
tcon->nativeFileSystem = cifs_strndup_from_utf16(bcc_ptr,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  322                                  
                      bytes_left, is_unicode,
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  323                                  
                      nls_codepage);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  324  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  325                  cifs_dbg(FYI, 
"nativeFileSystem=%s\n", tcon->nativeFileSystem);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  326  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  327                  if 
((smb_buffer_response->WordCount == 3) ||
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  328                           
(smb_buffer_response->WordCount == 7))
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  329                          /* 
field is in same location */
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  330                          
tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  331                  else
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  332                          
tcon->Flags = 0;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  333                  cifs_dbg(FYI, 
"Tcon flags: 0x%x\n", tcon->Flags);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  334          }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  335  
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  336          
cifs_buf_release(smb_buffer);
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  337          return rc;
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  338  }
d3986619ac1ea4 Ronnie Sahlberg 2021-08-17  339  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to