[linux-next:master 14488/14703] fs/ksmbd/oplock.c:659:28: sparse: sparse: incorrect type in assignment (different base types)

[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:   a67ba3cf9551f8c92d5ec9d7eae1aadbb9127b57
commit: 99bf6553fa9d5536cb3c1d331f6f2d1f7485b54d [14488/14703] smb3: fix ksmbd bigendian bug in oplock break, and move its struct to smbfs_common
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220330/202203302136.obhilFBp-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=99bf6553fa9d5536cb3c1d331f6f2d1f7485b54d
        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 99bf6553fa9d5536cb3c1d331f6f2d1f7485b54d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash fs/ksmbd/

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


sparse warnings: (new ones prefixed by >>)
>> fs/ksmbd/oplock.c:659:28: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] PersistentFid @@     got restricted __le64 [usertype] @@
   fs/ksmbd/oplock.c:659:28: sparse:     expected unsigned long long [usertype] PersistentFid
   fs/ksmbd/oplock.c:659:28: sparse:     got restricted __le64 [usertype]
>> fs/ksmbd/oplock.c:660:26: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] VolatileFid @@     got restricted __le64 [usertype] @@
   fs/ksmbd/oplock.c:660:26: sparse:     expected unsigned long long [usertype] VolatileFid
   fs/ksmbd/oplock.c:660:26: sparse:     got restricted __le64 [usertype]

vim +659 fs/ksmbd/oplock.c

e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  597  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  598  /**
95fa1ce947d60b fs/cifsd/oplock.c Hyunchul Lee  2021-03-21  599   * __smb2_oplock_break_noti() - send smb2 oplock break cmd from conn
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  600   * to client
95fa1ce947d60b fs/cifsd/oplock.c Hyunchul Lee  2021-03-21  601   * @wk:     smb work object
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  602   *
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  603   * There are two ways this function can be called. 1- while file open we break
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  604   * from exclusive/batch lock to levelII oplock and 2- while file write/truncate
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  605   * we break from levelII oplock no oplock.
e5066499079de0 fs/cifsd/oplock.c Namjae Jeon   2021-03-30  606   * work->request_buf contains oplock_info.
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  607   */
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  608  static void __smb2_oplock_break_noti(struct work_struct *wk)
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  609  {
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  610  	struct smb2_oplock_break *rsp = NULL;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  611  	struct ksmbd_work *work = container_of(wk, struct ksmbd_work, work);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  612  	struct ksmbd_conn *conn = work->conn;
e5066499079de0 fs/cifsd/oplock.c Namjae Jeon   2021-03-30  613  	struct oplock_break_info *br_info = work->request_buf;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  614  	struct smb2_hdr *rsp_hdr;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  615  	struct ksmbd_file *fp;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  616  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  617  	fp = ksmbd_lookup_durable_fd(br_info->fid);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  618  	if (!fp) {
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  619  		atomic_dec(&conn->r_count);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  620  		ksmbd_free_work_struct(work);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  621  		return;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  622  	}
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  623  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  624  	if (allocate_oplock_break_buf(work)) {
bde1694aecdb53 fs/cifsd/oplock.c Namjae Jeon   2021-06-28  625  		pr_err("smb2_allocate_rsp_buf failed! ");
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  626  		atomic_dec(&conn->r_count);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  627  		ksmbd_fd_put(work, fp);
a2ba2709f5e465 fs/cifsd/oplock.c Dan Carpenter 2021-03-18  628  		ksmbd_free_work_struct(work);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  629  		return;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  630  	}
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  631  
cb4517201b8acd fs/ksmbd/oplock.c Namjae Jeon   2021-11-03  632  	rsp_hdr = smb2_get_msg(work->response_buf);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  633  	memset(rsp_hdr, 0, sizeof(struct smb2_hdr) + 2);
cb4517201b8acd fs/ksmbd/oplock.c Namjae Jeon   2021-11-03  634  	*(__be32 *)work->response_buf =
cb4517201b8acd fs/ksmbd/oplock.c Namjae Jeon   2021-11-03  635  		cpu_to_be32(conn->vals->header_size);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  636  	rsp_hdr->ProtocolId = SMB2_PROTO_NUMBER;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  637  	rsp_hdr->StructureSize = SMB2_HEADER_STRUCTURE_SIZE;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  638  	rsp_hdr->CreditRequest = cpu_to_le16(0);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  639  	rsp_hdr->Command = SMB2_OPLOCK_BREAK;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  640  	rsp_hdr->Flags = (SMB2_FLAGS_SERVER_TO_REDIR);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  641  	rsp_hdr->NextCommand = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  642  	rsp_hdr->MessageId = cpu_to_le64(-1);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  643  	rsp_hdr->Id.SyncId.ProcessId = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  644  	rsp_hdr->Id.SyncId.TreeId = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  645  	rsp_hdr->SessionId = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  646  	memset(rsp_hdr->Signature, 0, 16);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  647  
cb4517201b8acd fs/ksmbd/oplock.c Namjae Jeon   2021-11-03  648  	rsp = smb2_get_msg(work->response_buf);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  649  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  650  	rsp->StructureSize = cpu_to_le16(24);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  651  	if (!br_info->open_trunc &&
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  652  	    (br_info->level == SMB2_OPLOCK_LEVEL_BATCH ||
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  653  	     br_info->level == SMB2_OPLOCK_LEVEL_EXCLUSIVE))
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  654  		rsp->OplockLevel = SMB2_OPLOCK_LEVEL_II;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  655  	else
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  656  		rsp->OplockLevel = SMB2_OPLOCK_LEVEL_NONE;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  657  	rsp->Reserved = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  658  	rsp->Reserved2 = 0;
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16 @659  	rsp->PersistentFid = cpu_to_le64(fp->persistent_id);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16 @660  	rsp->VolatileFid = cpu_to_le64(fp->volatile_id);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  661  
cb4517201b8acd fs/ksmbd/oplock.c Namjae Jeon   2021-11-03  662  	inc_rfc1001_len(work->response_buf, 24);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  663  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  664  	ksmbd_debug(OPLOCK,
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  665  		    "sending oplock break v_id %llu p_id = %llu lock level = %d\n",
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  666  		    rsp->VolatileFid, rsp->PersistentFid, rsp->OplockLevel);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  667  
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  668  	ksmbd_fd_put(work, fp);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  669  	ksmbd_conn_write(work);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  670  	ksmbd_free_work_struct(work);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  671  	atomic_dec(&conn->r_count);
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  672  }
e2f34481b24db2 fs/cifsd/oplock.c Namjae Jeon   2021-03-16  673  

:::::: The code at line 659 was first introduced by commit
:::::: e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9 cifsd: add server-side procedures for SMB3

:::::: TO: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
:::::: CC: Steve French <stfrench@xxxxxxxxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[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