aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
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 /fs/cifs/connect.c
parent26f57364d7cdef9d7ebe27c931fff5e4f21ffb1c (diff)
[CIFS] Fix warnings shown by newer version of sparse
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c61
1 files changed, 28 insertions, 33 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;