@@ -836,7 +836,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
836836 /* go from value to value + temp_len condensing
837837 double commas to singles. Note that this ends up
838838 allocating a few bytes too many, which is ok */
839- vol -> password = kcalloc ( 1 , temp_len , GFP_KERNEL );
839+ vol -> password = kzalloc ( temp_len , GFP_KERNEL );
840840 if (vol -> password == NULL ) {
841841 printk ("CIFS: no memory for pass\n" );
842842 return 1 ;
@@ -851,7 +851,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
851851 }
852852 vol -> password [j ] = 0 ;
853853 } else {
854- vol -> password = kcalloc ( 1 , temp_len + 1 , GFP_KERNEL );
854+ vol -> password = kzalloc ( temp_len + 1 , GFP_KERNEL );
855855 if (vol -> password == NULL ) {
856856 printk ("CIFS: no memory for pass\n" );
857857 return 1 ;
@@ -1317,7 +1317,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
13171317 sessinit is sent but no second negprot */
13181318 struct rfc1002_session_packet * ses_init_buf ;
13191319 struct smb_hdr * smb_buf ;
1320- ses_init_buf = kcalloc ( 1 , sizeof (struct rfc1002_session_packet ), GFP_KERNEL );
1320+ ses_init_buf = kzalloc ( sizeof (struct rfc1002_session_packet ), GFP_KERNEL );
13211321 if (ses_init_buf ) {
13221322 ses_init_buf -> trailer .session_req .called_len = 32 ;
13231323 rfc1002mangle (ses_init_buf -> trailer .session_req .called_name ,
@@ -1964,7 +1964,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
19641964/* We look for obvious messed up bcc or strings in response so we do not go off
19651965 the end since (at least) WIN2K and Windows XP have a major bug in not null
19661966 terminating last Unicode string in response */
1967- ses -> serverOS = kcalloc ( 1 , 2 * (len + 1 ), GFP_KERNEL );
1967+ ses -> serverOS = kzalloc ( 2 * (len + 1 ), GFP_KERNEL );
19681968 if (ses -> serverOS == NULL )
19691969 goto sesssetup_nomem ;
19701970 cifs_strfromUCS_le (ses -> serverOS ,
@@ -1976,7 +1976,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
19761976 if (remaining_words > 0 ) {
19771977 len = UniStrnlen ((wchar_t * )bcc_ptr ,
19781978 remaining_words - 1 );
1979- ses -> serverNOS = kcalloc ( 1 , 2 * (len + 1 ),GFP_KERNEL );
1979+ ses -> serverNOS = kzalloc ( 2 * (len + 1 ),GFP_KERNEL );
19801980 if (ses -> serverNOS == NULL )
19811981 goto sesssetup_nomem ;
19821982 cifs_strfromUCS_le (ses -> serverNOS ,
@@ -1994,7 +1994,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
19941994 len = UniStrnlen ((wchar_t * ) bcc_ptr , remaining_words );
19951995 /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
19961996 ses -> serverDomain =
1997- kcalloc ( 1 , 2 * (len + 1 ),GFP_KERNEL );
1997+ kzalloc ( 2 * (len + 1 ),GFP_KERNEL );
19981998 if (ses -> serverDomain == NULL )
19991999 goto sesssetup_nomem ;
20002000 cifs_strfromUCS_le (ses -> serverDomain ,
@@ -2005,22 +2005,22 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
20052005 } /* else no more room so create dummy domain string */
20062006 else
20072007 ses -> serverDomain =
2008- kcalloc ( 1 , 2 , GFP_KERNEL );
2008+ kzalloc ( 2 , GFP_KERNEL );
20092009 } else { /* no room so create dummy domain and NOS string */
20102010 /* if these kcallocs fail not much we
20112011 can do, but better to not fail the
20122012 sesssetup itself */
20132013 ses -> serverDomain =
2014- kcalloc ( 1 , 2 , GFP_KERNEL );
2014+ kzalloc ( 2 , GFP_KERNEL );
20152015 ses -> serverNOS =
2016- kcalloc ( 1 , 2 , GFP_KERNEL );
2016+ kzalloc ( 2 , GFP_KERNEL );
20172017 }
20182018 } else { /* ASCII */
20192019 len = strnlen (bcc_ptr , 1024 );
20202020 if (((long ) bcc_ptr + len ) - (long )
20212021 pByteArea (smb_buffer_response )
20222022 <= BCC (smb_buffer_response )) {
2023- ses -> serverOS = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
2023+ ses -> serverOS = kzalloc ( len + 1 ,GFP_KERNEL );
20242024 if (ses -> serverOS == NULL )
20252025 goto sesssetup_nomem ;
20262026 strncpy (ses -> serverOS ,bcc_ptr , len );
@@ -2030,7 +2030,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
20302030 bcc_ptr ++ ;
20312031
20322032 len = strnlen (bcc_ptr , 1024 );
2033- ses -> serverNOS = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
2033+ ses -> serverNOS = kzalloc ( len + 1 ,GFP_KERNEL );
20342034 if (ses -> serverNOS == NULL )
20352035 goto sesssetup_nomem ;
20362036 strncpy (ses -> serverNOS , bcc_ptr , len );
@@ -2039,7 +2039,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
20392039 bcc_ptr ++ ;
20402040
20412041 len = strnlen (bcc_ptr , 1024 );
2042- ses -> serverDomain = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
2042+ ses -> serverDomain = kzalloc ( len + 1 ,GFP_KERNEL );
20432043 if (ses -> serverDomain == NULL )
20442044 goto sesssetup_nomem ;
20452045 strncpy (ses -> serverDomain , bcc_ptr , len );
@@ -2240,7 +2240,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
22402240 the end since (at least) WIN2K and Windows XP have a major bug in not null
22412241 terminating last Unicode string in response */
22422242 ses -> serverOS =
2243- kcalloc ( 1 , 2 * (len + 1 ), GFP_KERNEL );
2243+ kzalloc ( 2 * (len + 1 ), GFP_KERNEL );
22442244 cifs_strfromUCS_le (ses -> serverOS ,
22452245 (wchar_t * )
22462246 bcc_ptr , len ,
@@ -2254,7 +2254,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
22542254 remaining_words
22552255 - 1 );
22562256 ses -> serverNOS =
2257- kcalloc ( 1 , 2 * (len + 1 ),
2257+ kzalloc ( 2 * (len + 1 ),
22582258 GFP_KERNEL );
22592259 cifs_strfromUCS_le (ses -> serverNOS ,
22602260 (wchar_t * )bcc_ptr ,
@@ -2267,7 +2267,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
22672267 if (remaining_words > 0 ) {
22682268 len = UniStrnlen ((wchar_t * ) bcc_ptr , remaining_words );
22692269 /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
2270- ses -> serverDomain = kcalloc ( 1 , 2 * (len + 1 ),GFP_KERNEL );
2270+ ses -> serverDomain = kzalloc ( 2 * (len + 1 ),GFP_KERNEL );
22712271 cifs_strfromUCS_le (ses -> serverDomain ,
22722272 (wchar_t * )bcc_ptr ,
22732273 len ,
@@ -2278,33 +2278,33 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
22782278 } /* else no more room so create dummy domain string */
22792279 else
22802280 ses -> serverDomain =
2281- kcalloc ( 1 , 2 ,GFP_KERNEL );
2281+ kzalloc ( 2 ,GFP_KERNEL );
22822282 } else { /* no room so create dummy domain and NOS string */
2283- ses -> serverDomain = kcalloc ( 1 , 2 , GFP_KERNEL );
2284- ses -> serverNOS = kcalloc ( 1 , 2 , GFP_KERNEL );
2283+ ses -> serverDomain = kzalloc ( 2 , GFP_KERNEL );
2284+ ses -> serverNOS = kzalloc ( 2 , GFP_KERNEL );
22852285 }
22862286 } else { /* ASCII */
22872287
22882288 len = strnlen (bcc_ptr , 1024 );
22892289 if (((long ) bcc_ptr + len ) - (long )
22902290 pByteArea (smb_buffer_response )
22912291 <= BCC (smb_buffer_response )) {
2292- ses -> serverOS = kcalloc ( 1 , len + 1 , GFP_KERNEL );
2292+ ses -> serverOS = kzalloc ( len + 1 , GFP_KERNEL );
22932293 strncpy (ses -> serverOS , bcc_ptr , len );
22942294
22952295 bcc_ptr += len ;
22962296 bcc_ptr [0 ] = 0 ; /* null terminate the string */
22972297 bcc_ptr ++ ;
22982298
22992299 len = strnlen (bcc_ptr , 1024 );
2300- ses -> serverNOS = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
2300+ ses -> serverNOS = kzalloc ( len + 1 ,GFP_KERNEL );
23012301 strncpy (ses -> serverNOS , bcc_ptr , len );
23022302 bcc_ptr += len ;
23032303 bcc_ptr [0 ] = 0 ;
23042304 bcc_ptr ++ ;
23052305
23062306 len = strnlen (bcc_ptr , 1024 );
2307- ses -> serverDomain = kcalloc ( 1 , len + 1 , GFP_KERNEL );
2307+ ses -> serverDomain = kzalloc ( len + 1 , GFP_KERNEL );
23082308 strncpy (ses -> serverDomain , bcc_ptr , len );
23092309 bcc_ptr += len ;
23102310 bcc_ptr [0 ] = 0 ;
@@ -2554,7 +2554,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
25542554 the end since (at least) WIN2K and Windows XP have a major bug in not null
25552555 terminating last Unicode string in response */
25562556 ses -> serverOS =
2557- kcalloc ( 1 , 2 * (len + 1 ), GFP_KERNEL );
2557+ kzalloc ( 2 * (len + 1 ), GFP_KERNEL );
25582558 cifs_strfromUCS_le (ses -> serverOS ,
25592559 (wchar_t * )
25602560 bcc_ptr , len ,
@@ -2569,7 +2569,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
25692569 remaining_words
25702570 - 1 );
25712571 ses -> serverNOS =
2572- kcalloc ( 1 , 2 * (len + 1 ),
2572+ kzalloc ( 2 * (len + 1 ),
25732573 GFP_KERNEL );
25742574 cifs_strfromUCS_le (ses ->
25752575 serverNOS ,
@@ -2586,7 +2586,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
25862586 len = UniStrnlen ((wchar_t * ) bcc_ptr , remaining_words );
25872587 /* last string is not always null terminated (for e.g. for Windows XP & 2000) */
25882588 ses -> serverDomain =
2589- kcalloc ( 1 , 2 *
2589+ kzalloc ( 2 *
25902590 (len +
25912591 1 ),
25922592 GFP_KERNEL );
@@ -2612,21 +2612,21 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
26122612 } /* else no more room so create dummy domain string */
26132613 else
26142614 ses -> serverDomain =
2615- kcalloc ( 1 , 2 ,
2615+ kzalloc ( 2 ,
26162616 GFP_KERNEL );
26172617 } else { /* no room so create dummy domain and NOS string */
26182618 ses -> serverDomain =
2619- kcalloc ( 1 , 2 , GFP_KERNEL );
2619+ kzalloc ( 2 , GFP_KERNEL );
26202620 ses -> serverNOS =
2621- kcalloc ( 1 , 2 , GFP_KERNEL );
2621+ kzalloc ( 2 , GFP_KERNEL );
26222622 }
26232623 } else { /* ASCII */
26242624 len = strnlen (bcc_ptr , 1024 );
26252625 if (((long ) bcc_ptr + len ) - (long )
26262626 pByteArea (smb_buffer_response )
26272627 <= BCC (smb_buffer_response )) {
26282628 ses -> serverOS =
2629- kcalloc ( 1 , len + 1 ,
2629+ kzalloc ( len + 1 ,
26302630 GFP_KERNEL );
26312631 strncpy (ses -> serverOS ,
26322632 bcc_ptr , len );
@@ -2637,7 +2637,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
26372637
26382638 len = strnlen (bcc_ptr , 1024 );
26392639 ses -> serverNOS =
2640- kcalloc ( 1 , len + 1 ,
2640+ kzalloc ( len + 1 ,
26412641 GFP_KERNEL );
26422642 strncpy (ses -> serverNOS , bcc_ptr , len );
26432643 bcc_ptr += len ;
@@ -2646,7 +2646,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
26462646
26472647 len = strnlen (bcc_ptr , 1024 );
26482648 ses -> serverDomain =
2649- kcalloc ( 1 , len + 1 ,
2649+ kzalloc ( len + 1 ,
26502650 GFP_KERNEL );
26512651 strncpy (ses -> serverDomain , bcc_ptr , len );
26522652 bcc_ptr += len ;
@@ -2948,7 +2948,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
29482948 the end since (at least) WIN2K and Windows XP have a major bug in not null
29492949 terminating last Unicode string in response */
29502950 ses -> serverOS =
2951- kcalloc ( 1 , 2 * (len + 1 ), GFP_KERNEL );
2951+ kzalloc ( 2 * (len + 1 ), GFP_KERNEL );
29522952 cifs_strfromUCS_le (ses -> serverOS ,
29532953 (wchar_t * )
29542954 bcc_ptr , len ,
@@ -2963,7 +2963,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
29632963 remaining_words
29642964 - 1 );
29652965 ses -> serverNOS =
2966- kcalloc ( 1 , 2 * (len + 1 ),
2966+ kzalloc ( 2 * (len + 1 ),
29672967 GFP_KERNEL );
29682968 cifs_strfromUCS_le (ses ->
29692969 serverNOS ,
@@ -2979,7 +2979,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
29792979 len = UniStrnlen ((wchar_t * ) bcc_ptr , remaining_words );
29802980 /* last string not always null terminated (e.g. for Windows XP & 2000) */
29812981 ses -> serverDomain =
2982- kcalloc ( 1 , 2 *
2982+ kzalloc ( 2 *
29832983 (len +
29842984 1 ),
29852985 GFP_KERNEL );
@@ -3004,32 +3004,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
30043004 = 0 ;
30053005 } /* else no more room so create dummy domain string */
30063006 else
3007- ses -> serverDomain = kcalloc ( 1 , 2 ,GFP_KERNEL );
3007+ ses -> serverDomain = kzalloc ( 2 ,GFP_KERNEL );
30083008 } else { /* no room so create dummy domain and NOS string */
3009- ses -> serverDomain = kcalloc ( 1 , 2 , GFP_KERNEL );
3010- ses -> serverNOS = kcalloc ( 1 , 2 , GFP_KERNEL );
3009+ ses -> serverDomain = kzalloc ( 2 , GFP_KERNEL );
3010+ ses -> serverNOS = kzalloc ( 2 , GFP_KERNEL );
30113011 }
30123012 } else { /* ASCII */
30133013 len = strnlen (bcc_ptr , 1024 );
30143014 if (((long ) bcc_ptr + len ) -
30153015 (long ) pByteArea (smb_buffer_response )
30163016 <= BCC (smb_buffer_response )) {
3017- ses -> serverOS = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
3017+ ses -> serverOS = kzalloc ( len + 1 ,GFP_KERNEL );
30183018 strncpy (ses -> serverOS ,bcc_ptr , len );
30193019
30203020 bcc_ptr += len ;
30213021 bcc_ptr [0 ] = 0 ; /* null terminate the string */
30223022 bcc_ptr ++ ;
30233023
30243024 len = strnlen (bcc_ptr , 1024 );
3025- ses -> serverNOS = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
3025+ ses -> serverNOS = kzalloc ( len + 1 ,GFP_KERNEL );
30263026 strncpy (ses -> serverNOS , bcc_ptr , len );
30273027 bcc_ptr += len ;
30283028 bcc_ptr [0 ] = 0 ;
30293029 bcc_ptr ++ ;
30303030
30313031 len = strnlen (bcc_ptr , 1024 );
3032- ses -> serverDomain = kcalloc ( 1 , len + 1 ,GFP_KERNEL );
3032+ ses -> serverDomain = kzalloc ( len + 1 ,GFP_KERNEL );
30333033 strncpy (ses -> serverDomain , bcc_ptr , len );
30343034 bcc_ptr += len ;
30353035 bcc_ptr [0 ] = 0 ;
@@ -3141,7 +3141,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
31413141 if (tcon -> nativeFileSystem )
31423142 kfree (tcon -> nativeFileSystem );
31433143 tcon -> nativeFileSystem =
3144- kcalloc ( 1 , length + 2 , GFP_KERNEL );
3144+ kzalloc ( length + 2 , GFP_KERNEL );
31453145 cifs_strfromUCS_le (tcon -> nativeFileSystem ,
31463146 (wchar_t * ) bcc_ptr ,
31473147 length , nls_codepage );
@@ -3159,7 +3159,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
31593159 if (tcon -> nativeFileSystem )
31603160 kfree (tcon -> nativeFileSystem );
31613161 tcon -> nativeFileSystem =
3162- kcalloc ( 1 , length + 1 , GFP_KERNEL );
3162+ kzalloc ( length + 1 , GFP_KERNEL );
31633163 strncpy (tcon -> nativeFileSystem , bcc_ptr ,
31643164 length );
31653165 }
0 commit comments