aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-08-30 21:10:17 -0400
committerSteve French <sfrench@us.ibm.com>2007-08-30 21:10:17 -0400
commit77159b4df894f9e5e31f709fb0e5e52f6c1b1048 (patch)
tree75702d1546938f23fbb8ba59285e437078eff1f8
parent26f57364d7cdef9d7ebe27c931fff5e4f21ffb1c (diff)
[CIFS] Fix warnings shown by newer version of sparse
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/connect.c61
-rw-r--r--fs/cifs/dir.c2
-rw-r--r--fs/cifs/inode.c4
-rw-r--r--fs/cifs/link.c2
4 files changed, 32 insertions, 37 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 3dd2d23e0649..f58fef5878c3 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2972,36 +2972,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2972 SecurityBlob->DomainName.Length = 0; 2972 SecurityBlob->DomainName.Length = 0;
2973 SecurityBlob->DomainName.MaximumLength = 0; 2973 SecurityBlob->DomainName.MaximumLength = 0;
2974 } else { 2974 } else {
2975 __u16 len = 2975 __u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2976 cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2977 nls_codepage); 2976 nls_codepage);
2978 len *= 2; 2977 ln *= 2;
2979 SecurityBlob->DomainName.MaximumLength = 2978 SecurityBlob->DomainName.MaximumLength =
2980 cpu_to_le16(len); 2979 cpu_to_le16(ln);
2981 SecurityBlob->DomainName.Buffer = 2980 SecurityBlob->DomainName.Buffer =
2982 cpu_to_le32(SecurityBlobLength); 2981 cpu_to_le32(SecurityBlobLength);
2983 bcc_ptr += len; 2982 bcc_ptr += ln;
2984 SecurityBlobLength += len; 2983 SecurityBlobLength += ln;
2985 SecurityBlob->DomainName.Length = 2984 SecurityBlob->DomainName.Length = cpu_to_le16(ln);
2986 cpu_to_le16(len);
2987 } 2985 }
2988 if (user == NULL) { 2986 if (user == NULL) {
2989 SecurityBlob->UserName.Buffer = 0; 2987 SecurityBlob->UserName.Buffer = 0;
2990 SecurityBlob->UserName.Length = 0; 2988 SecurityBlob->UserName.Length = 0;
2991 SecurityBlob->UserName.MaximumLength = 0; 2989 SecurityBlob->UserName.MaximumLength = 0;
2992 } else { 2990 } else {
2993 __u16 len = 2991 __u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
2994 cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
2995 nls_codepage); 2992 nls_codepage);
2996 len *= 2; 2993 ln *= 2;
2997 SecurityBlob->UserName.MaximumLength = 2994 SecurityBlob->UserName.MaximumLength =
2998 cpu_to_le16(len); 2995 cpu_to_le16(ln);
2999 SecurityBlob->UserName.Buffer = 2996 SecurityBlob->UserName.Buffer =
3000 cpu_to_le32(SecurityBlobLength); 2997 cpu_to_le32(SecurityBlobLength);
3001 bcc_ptr += len; 2998 bcc_ptr += ln;
3002 SecurityBlobLength += len; 2999 SecurityBlobLength += ln;
3003 SecurityBlob->UserName.Length = 3000 SecurityBlob->UserName.Length = cpu_to_le16(ln);
3004 cpu_to_le16(len);
3005 } 3001 }
3006 3002
3007 /* SecurityBlob->WorkstationName.Length = 3003 /* SecurityBlob->WorkstationName.Length =
@@ -3045,33 +3041,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3045 SecurityBlob->DomainName.Length = 0; 3041 SecurityBlob->DomainName.Length = 0;
3046 SecurityBlob->DomainName.MaximumLength = 0; 3042 SecurityBlob->DomainName.MaximumLength = 0;
3047 } else { 3043 } else {
3048 __u16 len; 3044 __u16 ln;
3049 negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; 3045 negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
3050 strncpy(bcc_ptr, domain, 63); 3046 strncpy(bcc_ptr, domain, 63);
3051 len = strnlen(domain, 64); 3047 ln = strnlen(domain, 64);
3052 SecurityBlob->DomainName.MaximumLength = 3048 SecurityBlob->DomainName.MaximumLength =
3053 cpu_to_le16(len); 3049 cpu_to_le16(ln);
3054 SecurityBlob->DomainName.Buffer = 3050 SecurityBlob->DomainName.Buffer =
3055 cpu_to_le32(SecurityBlobLength); 3051 cpu_to_le32(SecurityBlobLength);
3056 bcc_ptr += len; 3052 bcc_ptr += ln;
3057 SecurityBlobLength += len; 3053 SecurityBlobLength += ln;
3058 SecurityBlob->DomainName.Length = cpu_to_le16(len); 3054 SecurityBlob->DomainName.Length = cpu_to_le16(ln);
3059 } 3055 }
3060 if (user == NULL) { 3056 if (user == NULL) {
3061 SecurityBlob->UserName.Buffer = 0; 3057 SecurityBlob->UserName.Buffer = 0;
3062 SecurityBlob->UserName.Length = 0; 3058 SecurityBlob->UserName.Length = 0;
3063 SecurityBlob->UserName.MaximumLength = 0; 3059 SecurityBlob->UserName.MaximumLength = 0;
3064 } else { 3060 } else {
3065 __u16 len; 3061 __u16 ln;
3066 strncpy(bcc_ptr, user, 63); 3062 strncpy(bcc_ptr, user, 63);
3067 len = strnlen(user, 64); 3063 ln = strnlen(user, 64);
3068 SecurityBlob->UserName.MaximumLength = 3064 SecurityBlob->UserName.MaximumLength = cpu_to_le16(ln);
3069 cpu_to_le16(len);
3070 SecurityBlob->UserName.Buffer = 3065 SecurityBlob->UserName.Buffer =
3071 cpu_to_le32(SecurityBlobLength); 3066 cpu_to_le32(SecurityBlobLength);
3072 bcc_ptr += len; 3067 bcc_ptr += ln;
3073 SecurityBlobLength += len; 3068 SecurityBlobLength += ln;
3074 SecurityBlob->UserName.Length = cpu_to_le16(len); 3069 SecurityBlob->UserName.Length = cpu_to_le16(ln);
3075 } 3070 }
3076 /* BB fill in our workstation name if known BB */ 3071 /* BB fill in our workstation name if known BB */
3077 3072
@@ -3138,8 +3133,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3138 } else { 3133 } else {
3139 remaining_words = BCC(smb_buffer_response) / 2; 3134 remaining_words = BCC(smb_buffer_response) / 2;
3140 } 3135 }
3141 len = 3136 len = UniStrnlen((wchar_t *) bcc_ptr,
3142 UniStrnlen((wchar_t *) bcc_ptr,remaining_words - 1); 3137 remaining_words - 1);
3143/* We look for obvious messed up bcc or strings in response so we do not go off 3138/* We look for obvious messed up bcc or strings in response so we do not go off
3144 the end since (at least) WIN2K and Windows XP have a major bug in not null 3139 the end since (at least) WIN2K and Windows XP have a major bug in not null
3145 terminating last Unicode string in response */ 3140 terminating last Unicode string in response */
@@ -3223,7 +3218,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3223 <= BCC(smb_buffer_response)) { 3218 <= BCC(smb_buffer_response)) {
3224 if (ses->serverOS) 3219 if (ses->serverOS)
3225 kfree(ses->serverOS); 3220 kfree(ses->serverOS);
3226 ses->serverOS = kzalloc(len + 1,GFP_KERNEL); 3221 ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
3227 strncpy(ses->serverOS,bcc_ptr, len); 3222 strncpy(ses->serverOS,bcc_ptr, len);
3228 3223
3229 bcc_ptr += len; 3224 bcc_ptr += len;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 4830acc86d74..db5287abc30f 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -397,7 +397,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
397 /* BB Do not bother to decode buf since no 397 /* BB Do not bother to decode buf since no
398 local inode yet to put timestamps in, 398 local inode yet to put timestamps in,
399 but we can reuse it safely */ 399 but we can reuse it safely */
400 int bytes_written; 400 unsigned int bytes_written;
401 struct win_dev *pdev; 401 struct win_dev *pdev;
402 pdev = (struct win_dev *)buf; 402 pdev = (struct win_dev *)buf;
403 if (S_ISCHR(mode)) { 403 if (S_ISCHR(mode)) {
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 97ccc513730f..66436f527c3b 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1478,7 +1478,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1478 atomic_dec(&open_file->wrtPending); 1478 atomic_dec(&open_file->wrtPending);
1479 cFYI(1, ("SetFSize for attrs rc = %d", rc)); 1479 cFYI(1, ("SetFSize for attrs rc = %d", rc));
1480 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { 1480 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1481 int bytes_written; 1481 unsigned int bytes_written;
1482 rc = CIFSSMBWrite(xid, pTcon, 1482 rc = CIFSSMBWrite(xid, pTcon,
1483 nfid, 0, attrs->ia_size, 1483 nfid, 0, attrs->ia_size,
1484 &bytes_written, NULL, NULL, 1484 &bytes_written, NULL, NULL,
@@ -1511,7 +1511,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1511 cifs_sb->mnt_cifs_flags & 1511 cifs_sb->mnt_cifs_flags &
1512 CIFS_MOUNT_MAP_SPECIAL_CHR); 1512 CIFS_MOUNT_MAP_SPECIAL_CHR);
1513 if (rc == 0) { 1513 if (rc == 0) {
1514 int bytes_written; 1514 unsigned int bytes_written;
1515 rc = CIFSSMBWrite(xid, pTcon, 1515 rc = CIFSSMBWrite(xid, pTcon,
1516 netfid, 0, 1516 netfid, 0,
1517 attrs->ia_size, 1517 attrs->ia_size,
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 6a85ef7b8797..11f265726db7 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -237,7 +237,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
237 char *tmp_path = NULL; 237 char *tmp_path = NULL;
238 char *tmpbuffer; 238 char *tmpbuffer;
239 unsigned char *referrals = NULL; 239 unsigned char *referrals = NULL;
240 int num_referrals = 0; 240 unsigned int num_referrals = 0;
241 int len; 241 int len;
242 __u16 fid; 242 __u16 fid;
243 243