aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2009-03-31 04:28:36 -0400
committerSteve French <sfrench@us.ibm.com>2009-04-16 21:26:48 -0400
commit74496d365ad171d11f21da4a8be71c945f6ec825 (patch)
tree8e7296257188a6eb0fcb18811fbade47c9cd0100 /fs
parent0f4d634c59a4e062bef81c00d9e63333f2a83b46 (diff)
cifs: remove some pointless conditionals before kfree()
Remove some pointless conditionals before kfree(). Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/connect.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 0de3b5615a22..b173b0171712 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2673,8 +2673,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2673/* We look for obvious messed up bcc or strings in response so we do not go off 2673/* We look for obvious messed up bcc or strings in response so we do not go off
2674 the end since (at least) WIN2K and Windows XP have a major bug in not null 2674 the end since (at least) WIN2K and Windows XP have a major bug in not null
2675 terminating last Unicode string in response */ 2675 terminating last Unicode string in response */
2676 if (ses->serverOS) 2676 kfree(ses->serverOS);
2677 kfree(ses->serverOS);
2678 ses->serverOS = kzalloc(2 * (len + 1), 2677 ses->serverOS = kzalloc(2 * (len + 1),
2679 GFP_KERNEL); 2678 GFP_KERNEL);
2680 if (ses->serverOS == NULL) 2679 if (ses->serverOS == NULL)
@@ -2710,8 +2709,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2710 len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); 2709 len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
2711 /* last string is not always null terminated 2710 /* last string is not always null terminated
2712 (for e.g. for Windows XP & 2000) */ 2711 (for e.g. for Windows XP & 2000) */
2713 if (ses->serverDomain) 2712 kfree(ses->serverDomain);
2714 kfree(ses->serverDomain);
2715 ses->serverDomain = 2713 ses->serverDomain =
2716 kzalloc(2*(len+1), 2714 kzalloc(2*(len+1),
2717 GFP_KERNEL); 2715 GFP_KERNEL);
@@ -2725,8 +2723,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2725 ses->serverDomain[1+(2*len)] = 0; 2723 ses->serverDomain[1+(2*len)] = 0;
2726 } else { /* else no more room so create 2724 } else { /* else no more room so create
2727 dummy domain string */ 2725 dummy domain string */
2728 if (ses->serverDomain) 2726 kfree(ses->serverDomain);
2729 kfree(ses->serverDomain);
2730 ses->serverDomain = 2727 ses->serverDomain =
2731 kzalloc(2, GFP_KERNEL); 2728 kzalloc(2, GFP_KERNEL);
2732 } 2729 }
@@ -2772,8 +2769,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2772 bcc_ptr++; 2769 bcc_ptr++;
2773 2770
2774 len = strnlen(bcc_ptr, 1024); 2771 len = strnlen(bcc_ptr, 1024);
2775 if (ses->serverDomain) 2772 kfree(ses->serverDomain);
2776 kfree(ses->serverDomain);
2777 ses->serverDomain = kzalloc(len + 1, 2773 ses->serverDomain = kzalloc(len + 1,
2778 GFP_KERNEL); 2774 GFP_KERNEL);
2779 if (ses->serverDomain == NULL) 2775 if (ses->serverDomain == NULL)
@@ -3013,8 +3009,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
3013/* We look for obvious messed up bcc or strings in response so we do not go off 3009/* We look for obvious messed up bcc or strings in response so we do not go off
3014 the end since (at least) WIN2K and Windows XP have a major bug in not null 3010 the end since (at least) WIN2K and Windows XP have a major bug in not null
3015 terminating last Unicode string in response */ 3011 terminating last Unicode string in response */
3016 if (ses->serverOS) 3012 kfree(ses->serverOS);
3017 kfree(ses->serverOS);
3018 ses->serverOS = 3013 ses->serverOS =
3019 kzalloc(2 * (len + 1), GFP_KERNEL); 3014 kzalloc(2 * (len + 1), GFP_KERNEL);
3020 cifs_strfromUCS_le(ses->serverOS, 3015 cifs_strfromUCS_le(ses->serverOS,
@@ -3086,8 +3081,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
3086 if (((long) bcc_ptr + len) - (long) 3081 if (((long) bcc_ptr + len) - (long)
3087 pByteArea(smb_buffer_response) 3082 pByteArea(smb_buffer_response)
3088 <= BCC(smb_buffer_response)) { 3083 <= BCC(smb_buffer_response)) {
3089 if (ses->serverOS) 3084 kfree(ses->serverOS);
3090 kfree(ses->serverOS);
3091 ses->serverOS = 3085 ses->serverOS =
3092 kzalloc(len + 1, 3086 kzalloc(len + 1,
3093 GFP_KERNEL); 3087 GFP_KERNEL);
@@ -3414,8 +3408,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3414/* We look for obvious messed up bcc or strings in response so we do not go off 3408/* We look for obvious messed up bcc or strings in response so we do not go off
3415 the end since (at least) WIN2K and Windows XP have a major bug in not null 3409 the end since (at least) WIN2K and Windows XP have a major bug in not null
3416 terminating last Unicode string in response */ 3410 terminating last Unicode string in response */
3417 if (ses->serverOS) 3411 kfree(ses->serverOS);
3418 kfree(ses->serverOS);
3419 ses->serverOS = 3412 ses->serverOS =
3420 kzalloc(2 * (len + 1), GFP_KERNEL); 3413 kzalloc(2 * (len + 1), GFP_KERNEL);
3421 cifs_strfromUCS_le(ses->serverOS, 3414 cifs_strfromUCS_le(ses->serverOS,
@@ -3448,8 +3441,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3448 if (remaining_words > 0) { 3441 if (remaining_words > 0) {
3449 len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words); 3442 len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
3450 /* last string not always null terminated (e.g. for Windows XP & 2000) */ 3443 /* last string not always null terminated (e.g. for Windows XP & 2000) */
3451 if (ses->serverDomain) 3444 kfree(ses->serverDomain);
3452 kfree(ses->serverDomain);
3453 ses->serverDomain = 3445 ses->serverDomain =
3454 kzalloc(2 * 3446 kzalloc(2 *
3455 (len + 3447 (len +
@@ -3476,13 +3468,11 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3476 = 0; 3468 = 0;
3477 } /* else no more room so create dummy domain string */ 3469 } /* else no more room so create dummy domain string */
3478 else { 3470 else {
3479 if (ses->serverDomain) 3471 kfree(ses->serverDomain);
3480 kfree(ses->serverDomain);
3481 ses->serverDomain = kzalloc(2,GFP_KERNEL); 3472 ses->serverDomain = kzalloc(2,GFP_KERNEL);
3482 } 3473 }
3483 } else { /* no room so create dummy domain and NOS string */ 3474 } else { /* no room so create dummy domain and NOS string */
3484 if (ses->serverDomain) 3475 kfree(ses->serverDomain);
3485 kfree(ses->serverDomain);
3486 ses->serverDomain = kzalloc(2, GFP_KERNEL); 3476 ses->serverDomain = kzalloc(2, GFP_KERNEL);
3487 kfree(ses->serverNOS); 3477 kfree(ses->serverNOS);
3488 ses->serverNOS = kzalloc(2, GFP_KERNEL); 3478 ses->serverNOS = kzalloc(2, GFP_KERNEL);
@@ -3492,8 +3482,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3492 if (((long) bcc_ptr + len) - 3482 if (((long) bcc_ptr + len) -
3493 (long) pByteArea(smb_buffer_response) 3483 (long) pByteArea(smb_buffer_response)
3494 <= BCC(smb_buffer_response)) { 3484 <= BCC(smb_buffer_response)) {
3495 if (ses->serverOS) 3485 kfree(ses->serverOS);
3496 kfree(ses->serverOS);
3497 ses->serverOS = kzalloc(len + 1, GFP_KERNEL); 3486 ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
3498 strncpy(ses->serverOS,bcc_ptr, len); 3487 strncpy(ses->serverOS,bcc_ptr, len);
3499 3488
@@ -3512,8 +3501,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3512 bcc_ptr++; 3501 bcc_ptr++;
3513 3502
3514 len = strnlen(bcc_ptr, 1024); 3503 len = strnlen(bcc_ptr, 1024);
3515 if (ses->serverDomain) 3504 kfree(ses->serverDomain);
3516 kfree(ses->serverDomain);
3517 ses->serverDomain = 3505 ses->serverDomain =
3518 kzalloc(len+1, 3506 kzalloc(len+1,
3519 GFP_KERNEL); 3507 GFP_KERNEL);