[linux-next:master 11997/12116] fs/cifs/smb2pdu.c:3967:41: 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:   999569d59a0aa2509ae4a67ecc266c1134e37e7b
commit: 5c840ceb247ced42df472fff0d952603027eb66c [11997/12116] cifs: Create a new shared file holding smb2 pdu definitions
config: x86_64-randconfig-s021-20210908 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # 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=5c840ceb247ced42df472fff0d952603027eb66c
        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 5c840ceb247ced42df472fff0d952603027eb66c
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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/cifs/smb2pdu.c:118:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] TreeId @@     got unsigned int const [usertype] tid @@
   fs/cifs/smb2pdu.c:118:32: sparse:     expected restricted __le32 [usertype] TreeId
   fs/cifs/smb2pdu.c:118:32: sparse:     got unsigned int const [usertype] tid
   fs/cifs/smb2pdu.c:121:33: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] SessionId @@     got unsigned long long [usertype] Suid @@
   fs/cifs/smb2pdu.c:121:33: sparse:     expected restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:121:33: sparse:     got unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1253:36: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] SessionId @@     got unsigned long long [usertype] Suid @@
   fs/cifs/smb2pdu.c:1253:36: sparse:     expected restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:1253:36: sparse:     got unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1561:28: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] SessionId @@     got unsigned long long [usertype] Suid @@
   fs/cifs/smb2pdu.c:1561:28: sparse:     expected restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:1561:28: sparse:     got unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1587:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] Suid @@     got restricted __le64 [usertype] SessionId @@
   fs/cifs/smb2pdu.c:1587:27: sparse:     expected unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1587:27: sparse:     got restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:1526:27: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] Suid @@     got restricted __le64 [usertype] SessionId @@
   fs/cifs/smb2pdu.c:1526:27: sparse:     expected unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1526:27: sparse:     got restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:1718:28: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] SessionId @@     got unsigned long long [usertype] Suid @@
   fs/cifs/smb2pdu.c:1718:28: sparse:     expected restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:1718:28: sparse:     got unsigned long long [usertype] Suid
   fs/cifs/smb2pdu.c:1874:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] tid @@     got restricted __le32 [usertype] TreeId @@
   fs/cifs/smb2pdu.c:1874:19: sparse:     expected unsigned int [usertype] tid
   fs/cifs/smb2pdu.c:1874:19: sparse:     got restricted __le32 [usertype] TreeId
>> fs/cifs/smb2pdu.c:3967:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 [usertype] SessionId @@     got unsigned long @@
   fs/cifs/smb2pdu.c:3967:41: sparse:     expected restricted __le64 [usertype] SessionId
   fs/cifs/smb2pdu.c:3967:41: sparse:     got unsigned long
   fs/cifs/smb2pdu.c:3968:48: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] TreeId @@     got unsigned int @@
   fs/cifs/smb2pdu.c:3968:48: sparse:     expected restricted __le32 [usertype] TreeId
   fs/cifs/smb2pdu.c:3968:48: sparse:     got unsigned int

vim +3967 fs/cifs/smb2pdu.c

09a4707e763824 Pavel Shilovsky 2012-09-18  3882  
09a4707e763824 Pavel Shilovsky 2012-09-18  3883  /*
09a4707e763824 Pavel Shilovsky 2012-09-18  3884   * To form a chain of read requests, any read requests after the first should
09a4707e763824 Pavel Shilovsky 2012-09-18  3885   * have the end_of_chain boolean set to true.
09a4707e763824 Pavel Shilovsky 2012-09-18  3886   */
09a4707e763824 Pavel Shilovsky 2012-09-18  3887  static int
738f9de5cdb917 Pavel Shilovsky 2016-11-23  3888  smb2_new_read_req(void **buf, unsigned int *total_len,
2dabfd5baba641 Long Li         2017-11-07  3889  	struct cifs_io_parms *io_parms, struct cifs_readdata *rdata,
2dabfd5baba641 Long Li         2017-11-07  3890  	unsigned int remaining_bytes, int request_type)
09a4707e763824 Pavel Shilovsky 2012-09-18  3891  {
09a4707e763824 Pavel Shilovsky 2012-09-18  3892  	int rc = -EACCES;
b8f57ee8aad414 Pavel Shilovsky 2016-11-23  3893  	struct smb2_read_plain_req *req = NULL;
5c840ceb247ced Ronnie Sahlberg 2021-09-07  3894  	struct smb2_hdr *shdr;
352d96f3acc6e0 Aurelien Aptel  2020-05-31  3895  	struct TCP_Server_Info *server = io_parms->server;
09a4707e763824 Pavel Shilovsky 2012-09-18  3896  
352d96f3acc6e0 Aurelien Aptel  2020-05-31  3897  	rc = smb2_plain_req_init(SMB2_READ, io_parms->tcon, server,
352d96f3acc6e0 Aurelien Aptel  2020-05-31  3898  				 (void **) &req, total_len);
09a4707e763824 Pavel Shilovsky 2012-09-18  3899  	if (rc)
09a4707e763824 Pavel Shilovsky 2012-09-18  3900  		return rc;
2dabfd5baba641 Long Li         2017-11-07  3901  
2dabfd5baba641 Long Li         2017-11-07  3902  	if (server == NULL)
09a4707e763824 Pavel Shilovsky 2012-09-18  3903  		return -ECONNABORTED;
09a4707e763824 Pavel Shilovsky 2012-09-18  3904  
5c840ceb247ced Ronnie Sahlberg 2021-09-07  3905  	shdr = &req->hdr;
5c840ceb247ced Ronnie Sahlberg 2021-09-07  3906  	shdr->Id.SyncId.ProcessId = cpu_to_le32(io_parms->pid);
09a4707e763824 Pavel Shilovsky 2012-09-18  3907  
09a4707e763824 Pavel Shilovsky 2012-09-18  3908  	req->PersistentFileId = io_parms->persistent_fid;
09a4707e763824 Pavel Shilovsky 2012-09-18  3909  	req->VolatileFileId = io_parms->volatile_fid;
09a4707e763824 Pavel Shilovsky 2012-09-18  3910  	req->ReadChannelInfoOffset = 0; /* reserved */
09a4707e763824 Pavel Shilovsky 2012-09-18  3911  	req->ReadChannelInfoLength = 0; /* reserved */
09a4707e763824 Pavel Shilovsky 2012-09-18  3912  	req->Channel = 0; /* reserved */
09a4707e763824 Pavel Shilovsky 2012-09-18  3913  	req->MinimumCount = 0;
09a4707e763824 Pavel Shilovsky 2012-09-18  3914  	req->Length = cpu_to_le32(io_parms->length);
09a4707e763824 Pavel Shilovsky 2012-09-18  3915  	req->Offset = cpu_to_le64(io_parms->offset);
d323c24617527f Steve French    2019-02-25  3916  
d323c24617527f Steve French    2019-02-25  3917  	trace_smb3_read_enter(0 /* xid */,
d323c24617527f Steve French    2019-02-25  3918  			io_parms->persistent_fid,
d323c24617527f Steve French    2019-02-25  3919  			io_parms->tcon->tid, io_parms->tcon->ses->Suid,
d323c24617527f Steve French    2019-02-25  3920  			io_parms->offset, io_parms->length);
bd3dcc6a22a918 Long Li         2017-11-22  3921  #ifdef CONFIG_CIFS_SMB_DIRECT
bd3dcc6a22a918 Long Li         2017-11-22  3922  	/*
bd3dcc6a22a918 Long Li         2017-11-22  3923  	 * If we want to do a RDMA write, fill in and append
bd3dcc6a22a918 Long Li         2017-11-22  3924  	 * smbd_buffer_descriptor_v1 to the end of read request
bd3dcc6a22a918 Long Li         2017-11-22  3925  	 */
bb4c0419476bd3 Long Li         2018-04-17  3926  	if (server->rdma && rdata && !server->sign &&
bd3dcc6a22a918 Long Li         2017-11-22  3927  		rdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) {
bd3dcc6a22a918 Long Li         2017-11-22  3928  
bd3dcc6a22a918 Long Li         2017-11-22  3929  		struct smbd_buffer_descriptor_v1 *v1;
352d96f3acc6e0 Aurelien Aptel  2020-05-31  3930  		bool need_invalidate = server->dialect == SMB30_PROT_ID;
bd3dcc6a22a918 Long Li         2017-11-22  3931  
bd3dcc6a22a918 Long Li         2017-11-22  3932  		rdata->mr = smbd_register_mr(
bd3dcc6a22a918 Long Li         2017-11-22  3933  				server->smbd_conn, rdata->pages,
7cf20bce77581b Long Li         2018-05-30  3934  				rdata->nr_pages, rdata->page_offset,
7cf20bce77581b Long Li         2018-05-30  3935  				rdata->tailsz, true, need_invalidate);
bd3dcc6a22a918 Long Li         2017-11-22  3936  		if (!rdata->mr)
b7972092199f6d Long Li         2019-04-05  3937  			return -EAGAIN;
bd3dcc6a22a918 Long Li         2017-11-22  3938  
bd3dcc6a22a918 Long Li         2017-11-22  3939  		req->Channel = SMB2_CHANNEL_RDMA_V1_INVALIDATE;
bd3dcc6a22a918 Long Li         2017-11-22  3940  		if (need_invalidate)
bd3dcc6a22a918 Long Li         2017-11-22  3941  			req->Channel = SMB2_CHANNEL_RDMA_V1;
bd3dcc6a22a918 Long Li         2017-11-22  3942  		req->ReadChannelInfoOffset =
2026b06e9ce852 Steve French    2018-01-24  3943  			cpu_to_le16(offsetof(struct smb2_read_plain_req, Buffer));
bd3dcc6a22a918 Long Li         2017-11-22  3944  		req->ReadChannelInfoLength =
2026b06e9ce852 Steve French    2018-01-24  3945  			cpu_to_le16(sizeof(struct smbd_buffer_descriptor_v1));
bd3dcc6a22a918 Long Li         2017-11-22  3946  		v1 = (struct smbd_buffer_descriptor_v1 *) &req->Buffer[0];
2026b06e9ce852 Steve French    2018-01-24  3947  		v1->offset = cpu_to_le64(rdata->mr->mr->iova);
2026b06e9ce852 Steve French    2018-01-24  3948  		v1->token = cpu_to_le32(rdata->mr->mr->rkey);
2026b06e9ce852 Steve French    2018-01-24  3949  		v1->length = cpu_to_le32(rdata->mr->mr->length);
bd3dcc6a22a918 Long Li         2017-11-22  3950  
bd3dcc6a22a918 Long Li         2017-11-22  3951  		*total_len += sizeof(*v1) - 1;
bd3dcc6a22a918 Long Li         2017-11-22  3952  	}
bd3dcc6a22a918 Long Li         2017-11-22  3953  #endif
09a4707e763824 Pavel Shilovsky 2012-09-18  3954  	if (request_type & CHAINED_REQUEST) {
09a4707e763824 Pavel Shilovsky 2012-09-18  3955  		if (!(request_type & END_OF_CHAIN)) {
b8f57ee8aad414 Pavel Shilovsky 2016-11-23  3956  			/* next 8-byte aligned request */
b8f57ee8aad414 Pavel Shilovsky 2016-11-23  3957  			*total_len = DIV_ROUND_UP(*total_len, 8) * 8;
b8f57ee8aad414 Pavel Shilovsky 2016-11-23  3958  			shdr->NextCommand = cpu_to_le32(*total_len);
09a4707e763824 Pavel Shilovsky 2012-09-18  3959  		} else /* END_OF_CHAIN */
31473fc4f9653b Pavel Shilovsky 2016-10-24  3960  			shdr->NextCommand = 0;
09a4707e763824 Pavel Shilovsky 2012-09-18  3961  		if (request_type & RELATED_REQUEST) {
31473fc4f9653b Pavel Shilovsky 2016-10-24  3962  			shdr->Flags |= SMB2_FLAGS_RELATED_OPERATIONS;
09a4707e763824 Pavel Shilovsky 2012-09-18  3963  			/*
09a4707e763824 Pavel Shilovsky 2012-09-18  3964  			 * Related requests use info from previous read request
09a4707e763824 Pavel Shilovsky 2012-09-18  3965  			 * in chain.
09a4707e763824 Pavel Shilovsky 2012-09-18  3966  			 */
c0d46717b95735 Steve French    2021-05-15 @3967  			shdr->SessionId = 0xFFFFFFFFFFFFFFFF;
5c840ceb247ced Ronnie Sahlberg 2021-09-07  3968  			shdr->Id.SyncId.TreeId = 0xFFFFFFFF;
c0d46717b95735 Steve French    2021-05-15  3969  			req->PersistentFileId = 0xFFFFFFFFFFFFFFFF;
c0d46717b95735 Steve French    2021-05-15  3970  			req->VolatileFileId = 0xFFFFFFFFFFFFFFFF;
09a4707e763824 Pavel Shilovsky 2012-09-18  3971  		}
09a4707e763824 Pavel Shilovsky 2012-09-18  3972  	}
09a4707e763824 Pavel Shilovsky 2012-09-18  3973  	if (remaining_bytes > io_parms->length)
09a4707e763824 Pavel Shilovsky 2012-09-18  3974  		req->RemainingBytes = cpu_to_le32(remaining_bytes);
09a4707e763824 Pavel Shilovsky 2012-09-18  3975  	else
09a4707e763824 Pavel Shilovsky 2012-09-18  3976  		req->RemainingBytes = 0;
09a4707e763824 Pavel Shilovsky 2012-09-18  3977  
738f9de5cdb917 Pavel Shilovsky 2016-11-23  3978  	*buf = req;
09a4707e763824 Pavel Shilovsky 2012-09-18  3979  	return rc;
09a4707e763824 Pavel Shilovsky 2012-09-18  3980  }
09a4707e763824 Pavel Shilovsky 2012-09-18  3981  

:::::: The code at line 3967 was first introduced by commit
:::::: c0d46717b95735b0eacfddbcca9df37a49de9c7a SMB3: incorrect file id in requests compounded with open

:::::: TO: Steve French <stfrench@xxxxxxxxxxxxx>
:::::: CC: Steve French <stfrench@xxxxxxxxxxxxx>

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