Commit 77159b4d authored by Steve French's avatar Steve French
Browse files

[CIFS] Fix warnings shown by newer version of sparse



Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 26f57364
Loading
Loading
Loading
Loading
+28 −33
Original line number Diff line number Diff line
@@ -2972,36 +2972,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
			SecurityBlob->DomainName.Length = 0;
			SecurityBlob->DomainName.MaximumLength = 0;
		} else {
			__u16 len =
			    cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
			__u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
					  nls_codepage);
			len *= 2;
			ln *= 2;
			SecurityBlob->DomainName.MaximumLength =
			    cpu_to_le16(len);
			    cpu_to_le16(ln);
			SecurityBlob->DomainName.Buffer =
			    cpu_to_le32(SecurityBlobLength);
			bcc_ptr += len;
			SecurityBlobLength += len;
			SecurityBlob->DomainName.Length =
			    cpu_to_le16(len);
			bcc_ptr += ln;
			SecurityBlobLength += ln;
			SecurityBlob->DomainName.Length = cpu_to_le16(ln);
		}
		if (user == NULL) {
			SecurityBlob->UserName.Buffer = 0;
			SecurityBlob->UserName.Length = 0;
			SecurityBlob->UserName.MaximumLength = 0;
		} else {
			__u16 len =
			    cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
			__u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
					  nls_codepage);
			len *= 2;
			ln *= 2;
			SecurityBlob->UserName.MaximumLength =
			    cpu_to_le16(len);
			    cpu_to_le16(ln);
			SecurityBlob->UserName.Buffer =
			    cpu_to_le32(SecurityBlobLength);
			bcc_ptr += len;
			SecurityBlobLength += len;
			SecurityBlob->UserName.Length =
			    cpu_to_le16(len);
			bcc_ptr += ln;
			SecurityBlobLength += ln;
			SecurityBlob->UserName.Length = cpu_to_le16(ln);
		}

		/* SecurityBlob->WorkstationName.Length =
@@ -3045,33 +3041,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
			SecurityBlob->DomainName.Length = 0;
			SecurityBlob->DomainName.MaximumLength = 0;
		} else {
			__u16 len;
			__u16 ln;
			negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
			strncpy(bcc_ptr, domain, 63);
			len = strnlen(domain, 64);
			ln = strnlen(domain, 64);
			SecurityBlob->DomainName.MaximumLength =
			    cpu_to_le16(len);
			    cpu_to_le16(ln);
			SecurityBlob->DomainName.Buffer =
			    cpu_to_le32(SecurityBlobLength);
			bcc_ptr += len;
			SecurityBlobLength += len;
			SecurityBlob->DomainName.Length = cpu_to_le16(len);
			bcc_ptr += ln;
			SecurityBlobLength += ln;
			SecurityBlob->DomainName.Length = cpu_to_le16(ln);
		}
		if (user == NULL) {
			SecurityBlob->UserName.Buffer = 0;
			SecurityBlob->UserName.Length = 0;
			SecurityBlob->UserName.MaximumLength = 0;
		} else {
			__u16 len;
			__u16 ln;
			strncpy(bcc_ptr, user, 63);
			len = strnlen(user, 64);
			SecurityBlob->UserName.MaximumLength =
			    cpu_to_le16(len);
			ln = strnlen(user, 64);
			SecurityBlob->UserName.MaximumLength = cpu_to_le16(ln);
			SecurityBlob->UserName.Buffer =
						cpu_to_le32(SecurityBlobLength);
			bcc_ptr += len;
			SecurityBlobLength += len;
			SecurityBlob->UserName.Length = cpu_to_le16(len);
			bcc_ptr += ln;
			SecurityBlobLength += ln;
			SecurityBlob->UserName.Length = cpu_to_le16(ln);
		}
		/* BB fill in our workstation name if known BB */

@@ -3138,8 +3133,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
					} else {
						remaining_words = BCC(smb_buffer_response) / 2;
					}
					len =
					    UniStrnlen((wchar_t *) bcc_ptr,remaining_words - 1);
					len = UniStrnlen((wchar_t *) bcc_ptr,
							remaining_words - 1);
/* We look for obvious messed up bcc or strings in response so we do not go off
  the end since (at least) WIN2K and Windows XP have a major bug in not null
  terminating last Unicode string in response  */
+1 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
				/* BB Do not bother to decode buf since no
				   local inode yet to put timestamps in,
				   but we can reuse it safely */
				int bytes_written;
				unsigned int bytes_written;
				struct win_dev *pdev;
				pdev = (struct win_dev *)buf;
				if (S_ISCHR(mode)) {
+2 −2
Original line number Diff line number Diff line
@@ -1478,7 +1478,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
			atomic_dec(&open_file->wrtPending);
			cFYI(1, ("SetFSize for attrs rc = %d", rc));
			if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
				int bytes_written;
				unsigned int bytes_written;
				rc = CIFSSMBWrite(xid, pTcon,
						  nfid, 0, attrs->ia_size,
						  &bytes_written, NULL, NULL,
@@ -1511,7 +1511,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
					cifs_sb->mnt_cifs_flags &
						CIFS_MOUNT_MAP_SPECIAL_CHR);
				if (rc == 0) {
					int bytes_written;
					unsigned int bytes_written;
					rc = CIFSSMBWrite(xid, pTcon,
							netfid, 0,
							attrs->ia_size,
+1 −1
Original line number Diff line number Diff line
@@ -237,7 +237,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
	char *tmp_path = NULL;
	char *tmpbuffer;
	unsigned char *referrals = NULL;
	int num_referrals = 0;
	unsigned int num_referrals = 0;
	int len;
	__u16 fid;