[linux-next:master 8362/9113] fs/cifs/smb1ops.c:279:16: warning: taking address of packed member 'smb_buf_length' of class or structure 'smb_hdr' may result in an unaligned pointer value

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   33e65b1f975cd2814fc0ea9617250fc4c1d7a553
commit: d3986619ac1ea40c4f4a988edd4d0c569ed5cd9c [8362/9113] cifs: move functions that depend on DES to smp1ops.c
config: i386-randconfig-r033-20210819 (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 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   clang-14: warning: optimization flag '-falign-jumps=0' is not supported [-Wignored-optimization-argument]
   In file included from fs/cifs/smb1ops.c:10:
   In file included from include/linux/pagemap.h:8:
   In file included from include/linux/mm.h:10:
   In file included from include/linux/gfp.h:6:
   In file included from include/linux/mmzone.h:8:
   In file included from include/linux/spinlock.h:51:
   In file included from include/linux/preempt.h:78:
   In file included from arch/x86/include/asm/preempt.h:7:
   In file included from include/linux/thread_info.h:60:
   arch/x86/include/asm/thread_info.h:172:13: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
           oldframe = __builtin_frame_address(1);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/thread_info.h:174:11: warning: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Wframe-address]
                   frame = __builtin_frame_address(2);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/cifs/smb1ops.c:279:16: warning: taking address of packed member 'smb_buf_length' of class or structure 'smb_hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
           be32_add_cpu(&pSMB->hdr.smb_buf_length, count);
                         ^~~~~~~~~~~~~~~~~~~~~~~~
   3 warnings generated.


vim +279 fs/cifs/smb1ops.c

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

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux