<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;

This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.

Signed-off-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 fs/cifs/connect.c        |   82 +++++++++++++++++++++++------------------------
 fs/freevxfs/vxfs_super.c |    2 -
 2 files changed, 42 insertions(+), 42 deletions(-)

diff -puN fs/cifs/connect.c~fs-convert-kcalloc-to-kzalloc fs/cifs/connect.c
--- devel/fs/cifs/connect.c~fs-convert-kcalloc-to-kzalloc	2005-08-06 14:35:19.000000000 -0700
+++ devel-akpm/fs/cifs/connect.c	2005-08-06 14:35:19.000000000 -0700
@@ -836,7 +836,7 @@ cifs_parse_mount_options(char *options, 
 				/* go from value to value + temp_len condensing 
 				double commas to singles. Note that this ends up
 				allocating a few bytes too many, which is ok */
-				vol-&gt;password = kcalloc(1, temp_len, GFP_KERNEL);
+				vol-&gt;password = kzalloc(temp_len, GFP_KERNEL);
 				if(vol-&gt;password == NULL) {
 					printk("CIFS: no memory for pass\n");
 					return 1;
@@ -851,7 +851,7 @@ cifs_parse_mount_options(char *options, 
 				}
 				vol-&gt;password[j] = 0;
 			} else {
-				vol-&gt;password = kcalloc(1, temp_len+1, GFP_KERNEL);
+				vol-&gt;password = kzalloc(temp_len+1, GFP_KERNEL);
 				if(vol-&gt;password == NULL) {
 					printk("CIFS: no memory for pass\n");
 					return 1;
@@ -1317,7 +1317,7 @@ ipv4_connect(struct sockaddr_in *psin_se
 		sessinit is sent but no second negprot */
 		struct rfc1002_session_packet * ses_init_buf;
 		struct smb_hdr * smb_buf;
-		ses_init_buf = kcalloc(1, sizeof(struct rfc1002_session_packet), GFP_KERNEL);
+		ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL);
 		if(ses_init_buf) {
 			ses_init_buf-&gt;trailer.session_req.called_len = 32;
 			rfc1002mangle(ses_init_buf-&gt;trailer.session_req.called_name,
@@ -1964,7 +1964,7 @@ CIFSSessSetup(unsigned int xid, struct c
 /* 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  */
-				ses-&gt;serverOS = kcalloc(1, 2 * (len + 1), GFP_KERNEL);
+				ses-&gt;serverOS = kzalloc(2 * (len + 1), GFP_KERNEL);
 				if(ses-&gt;serverOS == NULL)
 					goto sesssetup_nomem;
 				cifs_strfromUCS_le(ses-&gt;serverOS,
@@ -1976,7 +1976,7 @@ CIFSSessSetup(unsigned int xid, struct c
 				if (remaining_words &gt; 0) {
 					len = UniStrnlen((wchar_t *)bcc_ptr,
 							 remaining_words-1);
-					ses-&gt;serverNOS = kcalloc(1, 2 * (len + 1),GFP_KERNEL);
+					ses-&gt;serverNOS = kzalloc(2 * (len + 1),GFP_KERNEL);
 					if(ses-&gt;serverNOS == NULL)
 						goto sesssetup_nomem;
 					cifs_strfromUCS_le(ses-&gt;serverNOS,
@@ -1994,7 +1994,7 @@ CIFSSessSetup(unsigned int xid, struct c
 						len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);
           /* last string is not always null terminated (for e.g. for Windows XP &amp; 2000) */
 						ses-&gt;serverDomain =
-						    kcalloc(1, 2*(len+1),GFP_KERNEL);
+						    kzalloc(2*(len+1),GFP_KERNEL);
 						if(ses-&gt;serverDomain == NULL)
 							goto sesssetup_nomem;
 						cifs_strfromUCS_le(ses-&gt;serverDomain,
@@ -2005,22 +2005,22 @@ CIFSSessSetup(unsigned int xid, struct c
 					} /* else no more room so create dummy domain string */
 					else
 						ses-&gt;serverDomain = 
-							kcalloc(1, 2, GFP_KERNEL);
+							kzalloc(2, GFP_KERNEL);
 				} else {	/* no room so create dummy domain and NOS string */
 					/* if these kcallocs fail not much we
 					   can do, but better to not fail the
 					   sesssetup itself */
 					ses-&gt;serverDomain =
-					    kcalloc(1, 2, GFP_KERNEL);
+					    kzalloc(2, GFP_KERNEL);
 					ses-&gt;serverNOS =
-					    kcalloc(1, 2, GFP_KERNEL);
+					    kzalloc(2, GFP_KERNEL);
 				}
 			} else {	/* ASCII */
 				len = strnlen(bcc_ptr, 1024);
 				if (((long) bcc_ptr + len) - (long)
 				    pByteArea(smb_buffer_response)
 					    &lt;= BCC(smb_buffer_response)) {
-					ses-&gt;serverOS = kcalloc(1, len + 1,GFP_KERNEL);
+					ses-&gt;serverOS = kzalloc(len + 1,GFP_KERNEL);
 					if(ses-&gt;serverOS == NULL)
 						goto sesssetup_nomem;
 					strncpy(ses-&gt;serverOS,bcc_ptr, len);
@@ -2030,7 +2030,7 @@ CIFSSessSetup(unsigned int xid, struct c
 					bcc_ptr++;
 
 					len = strnlen(bcc_ptr, 1024);
-					ses-&gt;serverNOS = kcalloc(1, len + 1,GFP_KERNEL);
+					ses-&gt;serverNOS = kzalloc(len + 1,GFP_KERNEL);
 					if(ses-&gt;serverNOS == NULL)
 						goto sesssetup_nomem;
 					strncpy(ses-&gt;serverNOS, bcc_ptr, len);
@@ -2039,7 +2039,7 @@ CIFSSessSetup(unsigned int xid, struct c
 					bcc_ptr++;
 
 					len = strnlen(bcc_ptr, 1024);
-					ses-&gt;serverDomain = kcalloc(1, len + 1,GFP_KERNEL);
+					ses-&gt;serverDomain = kzalloc(len + 1,GFP_KERNEL);
 					if(ses-&gt;serverDomain == NULL)
 						goto sesssetup_nomem;
 					strncpy(ses-&gt;serverDomain, bcc_ptr, len);
@@ -2240,7 +2240,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st
    the end since (at least) WIN2K and Windows XP have a major bug in not null
    terminating last Unicode string in response  */
 					ses-&gt;serverOS =
-					    kcalloc(1, 2 * (len + 1), GFP_KERNEL);
+					    kzalloc(2 * (len + 1), GFP_KERNEL);
 					cifs_strfromUCS_le(ses-&gt;serverOS,
 							   (wchar_t *)
 							   bcc_ptr, len,
@@ -2254,7 +2254,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st
 								 remaining_words
 								 - 1);
 						ses-&gt;serverNOS =
-						    kcalloc(1, 2 * (len + 1),
+						    kzalloc(2 * (len + 1),
 							    GFP_KERNEL);
 						cifs_strfromUCS_le(ses-&gt;serverNOS,
 								   (wchar_t *)bcc_ptr,
@@ -2267,7 +2267,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st
 						if (remaining_words &gt; 0) {
 							len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);	
                             /* last string is not always null terminated (for e.g. for Windows XP &amp; 2000) */
-							ses-&gt;serverDomain = kcalloc(1, 2*(len+1),GFP_KERNEL);
+							ses-&gt;serverDomain = kzalloc(2*(len+1),GFP_KERNEL);
 							cifs_strfromUCS_le(ses-&gt;serverDomain,
 							     (wchar_t *)bcc_ptr, 
                                  len,
@@ -2278,10 +2278,10 @@ CIFSSpnegoSessSetup(unsigned int xid, st
 						} /* else no more room so create dummy domain string */
 						else
 							ses-&gt;serverDomain =
-							    kcalloc(1, 2,GFP_KERNEL);
+							    kzalloc(2,GFP_KERNEL);
 					} else {	/* no room so create dummy domain and NOS string */
-						ses-&gt;serverDomain = kcalloc(1, 2, GFP_KERNEL);
-						ses-&gt;serverNOS = kcalloc(1, 2, GFP_KERNEL);
+						ses-&gt;serverDomain = kzalloc(2, GFP_KERNEL);
+						ses-&gt;serverNOS = kzalloc(2, GFP_KERNEL);
 					}
 				} else {	/* ASCII */
 
@@ -2289,7 +2289,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st
 					if (((long) bcc_ptr + len) - (long)
 					    pByteArea(smb_buffer_response)
 					    &lt;= BCC(smb_buffer_response)) {
-						ses-&gt;serverOS = kcalloc(1, len + 1, GFP_KERNEL);
+						ses-&gt;serverOS = kzalloc(len + 1, GFP_KERNEL);
 						strncpy(ses-&gt;serverOS, bcc_ptr, len);
 
 						bcc_ptr += len;
@@ -2297,14 +2297,14 @@ CIFSSpnegoSessSetup(unsigned int xid, st
 						bcc_ptr++;
 
 						len = strnlen(bcc_ptr, 1024);
-						ses-&gt;serverNOS = kcalloc(1, len + 1,GFP_KERNEL);
+						ses-&gt;serverNOS = kzalloc(len + 1,GFP_KERNEL);
 						strncpy(ses-&gt;serverNOS, bcc_ptr, len);
 						bcc_ptr += len;
 						bcc_ptr[0] = 0;
 						bcc_ptr++;
 
 						len = strnlen(bcc_ptr, 1024);
-						ses-&gt;serverDomain = kcalloc(1, len + 1, GFP_KERNEL);
+						ses-&gt;serverDomain = kzalloc(len + 1, GFP_KERNEL);
 						strncpy(ses-&gt;serverDomain, bcc_ptr, len);
 						bcc_ptr += len;
 						bcc_ptr[0] = 0;
@@ -2554,7 +2554,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
    the end since (at least) WIN2K and Windows XP have a major bug in not null
    terminating last Unicode string in response  */
 					ses-&gt;serverOS =
-					    kcalloc(1, 2 * (len + 1), GFP_KERNEL);
+					    kzalloc(2 * (len + 1), GFP_KERNEL);
 					cifs_strfromUCS_le(ses-&gt;serverOS,
 							   (wchar_t *)
 							   bcc_ptr, len,
@@ -2569,7 +2569,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 								 remaining_words
 								 - 1);
 						ses-&gt;serverNOS =
-						    kcalloc(1, 2 * (len + 1),
+						    kzalloc(2 * (len + 1),
 							    GFP_KERNEL);
 						cifs_strfromUCS_le(ses-&gt;
 								   serverNOS,
@@ -2586,7 +2586,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 							len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);	
            /* last string is not always null terminated (for e.g. for Windows XP &amp; 2000) */
 							ses-&gt;serverDomain =
-							    kcalloc(1, 2 *
+							    kzalloc(2 *
 								    (len +
 								     1),
 								    GFP_KERNEL);
@@ -2612,13 +2612,13 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 						} /* else no more room so create dummy domain string */
 						else
 							ses-&gt;serverDomain =
-							    kcalloc(1, 2,
+							    kzalloc(2,
 								    GFP_KERNEL);
 					} else {	/* no room so create dummy domain and NOS string */
 						ses-&gt;serverDomain =
-						    kcalloc(1, 2, GFP_KERNEL);
+						    kzalloc(2, GFP_KERNEL);
 						ses-&gt;serverNOS =
-						    kcalloc(1, 2, GFP_KERNEL);
+						    kzalloc(2, GFP_KERNEL);
 					}
 				} else {	/* ASCII */
 					len = strnlen(bcc_ptr, 1024);
@@ -2626,7 +2626,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 					    pByteArea(smb_buffer_response)
 					    &lt;= BCC(smb_buffer_response)) {
 						ses-&gt;serverOS =
-						    kcalloc(1, len + 1,
+						    kzalloc(len + 1,
 							    GFP_KERNEL);
 						strncpy(ses-&gt;serverOS,
 							bcc_ptr, len);
@@ -2637,7 +2637,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 
 						len = strnlen(bcc_ptr, 1024);
 						ses-&gt;serverNOS =
-						    kcalloc(1, len + 1,
+						    kzalloc(len + 1,
 							    GFP_KERNEL);
 						strncpy(ses-&gt;serverNOS, bcc_ptr, len);
 						bcc_ptr += len;
@@ -2646,7 +2646,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i
 
 						len = strnlen(bcc_ptr, 1024);
 						ses-&gt;serverDomain =
-						    kcalloc(1, len + 1,
+						    kzalloc(len + 1,
 							    GFP_KERNEL);
 						strncpy(ses-&gt;serverDomain, bcc_ptr, len);	
 						bcc_ptr += len;
@@ -2948,7 +2948,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi
   the end since (at least) WIN2K and Windows XP have a major bug in not null
   terminating last Unicode string in response  */
 					ses-&gt;serverOS =
-					    kcalloc(1, 2 * (len + 1), GFP_KERNEL);
+					    kzalloc(2 * (len + 1), GFP_KERNEL);
 					cifs_strfromUCS_le(ses-&gt;serverOS,
 							   (wchar_t *)
 							   bcc_ptr, len,
@@ -2963,7 +2963,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi
 								 remaining_words
 								 - 1);
 						ses-&gt;serverNOS =
-						    kcalloc(1, 2 * (len + 1),
+						    kzalloc(2 * (len + 1),
 							    GFP_KERNEL);
 						cifs_strfromUCS_le(ses-&gt;
 								   serverNOS,
@@ -2979,7 +2979,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi
 							len = UniStrnlen((wchar_t *) bcc_ptr, remaining_words);	
      /* last string not always null terminated (e.g. for Windows XP &amp; 2000) */
 							ses-&gt;serverDomain =
-							    kcalloc(1, 2 *
+							    kzalloc(2 *
 								    (len +
 								     1),
 								    GFP_KERNEL);
@@ -3004,17 +3004,17 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi
 							    = 0;
 						} /* else no more room so create dummy domain string */
 						else
-							ses-&gt;serverDomain = kcalloc(1, 2,GFP_KERNEL);
+							ses-&gt;serverDomain = kzalloc(2,GFP_KERNEL);
 					} else {  /* no room so create dummy domain and NOS string */
-						ses-&gt;serverDomain = kcalloc(1, 2, GFP_KERNEL);
-						ses-&gt;serverNOS = kcalloc(1, 2, GFP_KERNEL);
+						ses-&gt;serverDomain = kzalloc(2, GFP_KERNEL);
+						ses-&gt;serverNOS = kzalloc(2, GFP_KERNEL);
 					}
 				} else {	/* ASCII */
 					len = strnlen(bcc_ptr, 1024);
 					if (((long) bcc_ptr + len) - 
                         (long) pByteArea(smb_buffer_response) 
                             &lt;= BCC(smb_buffer_response)) {
-						ses-&gt;serverOS = kcalloc(1, len + 1,GFP_KERNEL);
+						ses-&gt;serverOS = kzalloc(len + 1,GFP_KERNEL);
 						strncpy(ses-&gt;serverOS,bcc_ptr, len);
 
 						bcc_ptr += len;
@@ -3022,14 +3022,14 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi
 						bcc_ptr++;
 
 						len = strnlen(bcc_ptr, 1024);
-						ses-&gt;serverNOS = kcalloc(1, len+1,GFP_KERNEL);
+						ses-&gt;serverNOS = kzalloc(len+1,GFP_KERNEL);
 						strncpy(ses-&gt;serverNOS, bcc_ptr, len);	
 						bcc_ptr += len;
 						bcc_ptr[0] = 0;
 						bcc_ptr++;
 
 						len = strnlen(bcc_ptr, 1024);
-						ses-&gt;serverDomain = kcalloc(1, len+1,GFP_KERNEL);
+						ses-&gt;serverDomain = kzalloc(len+1,GFP_KERNEL);
 						strncpy(ses-&gt;serverDomain, bcc_ptr, len);
 						bcc_ptr += len;
 						bcc_ptr[0] = 0;
@@ -3141,7 +3141,7 @@ CIFSTCon(unsigned int xid, struct cifsSe
 				if(tcon-&gt;nativeFileSystem)
 					kfree(tcon-&gt;nativeFileSystem);
 				tcon-&gt;nativeFileSystem =
-				    kcalloc(1, length + 2, GFP_KERNEL);
+				    kzalloc(length + 2, GFP_KERNEL);
 				cifs_strfromUCS_le(tcon-&gt;nativeFileSystem,
 						   (wchar_t *) bcc_ptr,
 						   length, nls_codepage);
@@ -3159,7 +3159,7 @@ CIFSTCon(unsigned int xid, struct cifsSe
 				if(tcon-&gt;nativeFileSystem)
 					kfree(tcon-&gt;nativeFileSystem);
 				tcon-&gt;nativeFileSystem =
-				    kcalloc(1, length + 1, GFP_KERNEL);
+				    kzalloc(length + 1, GFP_KERNEL);
 				strncpy(tcon-&gt;nativeFileSystem, bcc_ptr,
 					length);
 			}
diff -puN fs/freevxfs/vxfs_super.c~fs-convert-kcalloc-to-kzalloc fs/freevxfs/vxfs_super.c
--- devel/fs/freevxfs/vxfs_super.c~fs-convert-kcalloc-to-kzalloc	2005-08-06 14:35:19.000000000 -0700
+++ devel-akpm/fs/freevxfs/vxfs_super.c	2005-08-06 14:35:19.000000000 -0700
@@ -155,7 +155,7 @@ static int vxfs_fill_super(struct super_
 
 	sbp-&gt;s_flags |= MS_RDONLY;
 
-	infp = kcalloc(1, sizeof(*infp), GFP_KERNEL);
+	infp = kzalloc(sizeof(*infp), GFP_KERNEL);
 	if (!infp) {
 		printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n");
 		return -ENOMEM;
_
</pre></body></html>