Replace kmalloc+memset with kzalloc 
Patch 7/17

Signed-off-by: Yan Burman <yan_952@hotmail.com>

diff -rubp linux-2.6.19-rc5_orig/fs/affs/bitmap.c linux-2.6.19-rc5_kzalloc/fs/affs/bitmap.c
--- linux-2.6.19-rc5_orig/fs/affs/bitmap.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/affs/bitmap.c	2006-11-11 22:44:04.000000000 +0200
@@ -289,12 +289,11 @@ int affs_init_bitmap(struct super_block 
 	sbi->s_bmap_count = (sbi->s_partition_size - sbi->s_reserved +
 				 sbi->s_bmap_bits - 1) / sbi->s_bmap_bits;
 	size = sbi->s_bmap_count * sizeof(*bm);
-	bm = sbi->s_bitmap = kmalloc(size, GFP_KERNEL);
+	bm = sbi->s_bitmap = kzalloc(size, GFP_KERNEL);
 	if (!sbi->s_bitmap) {
 		printk(KERN_ERR "AFFS: Bitmap allocation failed\n");
 		return -ENOMEM;
 	}
-	memset(sbi->s_bitmap, 0, size);
 
 	bmap_blk = (__be32 *)sbi->s_root_bh->b_data;
 	blk = sb->s_blocksize / 4 - 49;
diff -rubp linux-2.6.19-rc5_orig/fs/afs/server.c linux-2.6.19-rc5_kzalloc/fs/afs/server.c
--- linux-2.6.19-rc5_orig/fs/afs/server.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/afs/server.c	2006-11-11 22:44:04.000000000 +0200
@@ -55,13 +55,12 @@ int afs_server_lookup(struct afs_cell *c
 	_enter("%p,%08x,", cell, ntohl(addr->s_addr));
 
 	/* allocate and initialise a server record */
-	server = kmalloc(sizeof(struct afs_server), GFP_KERNEL);
+	server = kzalloc(sizeof(struct afs_server), GFP_KERNEL);
 	if (!server) {
 		_leave(" = -ENOMEM");
 		return -ENOMEM;
 	}
 
-	memset(server, 0, sizeof(struct afs_server));
 	atomic_set(&server->usage, 1);
 
 	INIT_LIST_HEAD(&server->link);
diff -rubp linux-2.6.19-rc5_orig/fs/afs/super.c linux-2.6.19-rc5_kzalloc/fs/afs/super.c
--- linux-2.6.19-rc5_orig/fs/afs/super.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/afs/super.c	2006-11-11 22:44:04.000000000 +0200
@@ -242,14 +242,12 @@ static int afs_fill_super(struct super_b
 	kenter("");
 
 	/* allocate a superblock info record */
-	as = kmalloc(sizeof(struct afs_super_info), GFP_KERNEL);
+	as = kzalloc(sizeof(struct afs_super_info), GFP_KERNEL);
 	if (!as) {
 		_leave(" = -ENOMEM");
 		return -ENOMEM;
 	}
 
-	memset(as, 0, sizeof(struct afs_super_info));
-
 	afs_get_volume(params->volume);
 	as->volume = params->volume;
 
diff -rubp linux-2.6.19-rc5_orig/fs/autofs4/inode.c linux-2.6.19-rc5_kzalloc/fs/autofs4/inode.c
--- linux-2.6.19-rc5_orig/fs/autofs4/inode.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/autofs4/inode.c	2006-11-11 22:44:04.000000000 +0200
@@ -300,13 +300,11 @@ int autofs4_fill_super(struct super_bloc
 	struct autofs_sb_info *sbi;
 	struct autofs_info *ino;
 
-	sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL);
+	sbi = (struct autofs_sb_info *) kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if ( !sbi )
 		goto fail_unlock;
 	DPRINTK("starting up, sbi = %p",sbi);
 
-	memset(sbi, 0, sizeof(*sbi));
-
 	s->s_fs_info = sbi;
 	sbi->magic = AUTOFS_SBI_MAGIC;
 	sbi->pipefd = -1;
diff -rubp linux-2.6.19-rc5_orig/fs/binfmt_elf_fdpic.c linux-2.6.19-rc5_kzalloc/fs/binfmt_elf_fdpic.c
--- linux-2.6.19-rc5_orig/fs/binfmt_elf_fdpic.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/binfmt_elf_fdpic.c	2006-11-11 22:44:04.000000000 +0200
@@ -709,12 +709,11 @@ static int elf_fdpic_map_file(struct elf
 		return -ELIBBAD;
 
 	size = sizeof(*loadmap) + nloads * sizeof(*seg);
-	loadmap = kmalloc(size, GFP_KERNEL);
+	loadmap = kzalloc(size, GFP_KERNEL);
 	if (!loadmap)
 		return -ENOMEM;
 
 	params->loadmap = loadmap;
-	memset(loadmap, 0, size);
 
 	loadmap->version = ELF32_FDPIC_LOADMAP_VERSION;
 	loadmap->nsegs = nloads;
diff -rubp linux-2.6.19-rc5_orig/fs/cifs/connect.c linux-2.6.19-rc5_kzalloc/fs/cifs/connect.c
--- linux-2.6.19-rc5_orig/fs/cifs/connect.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/cifs/connect.c	2006-11-11 22:44:18.000000000 +0200
@@ -1755,7 +1755,7 @@ cifs_mount(struct super_block *sb, struc
 			return rc;
 		}
 
-		srvTcp = kmalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL);
+		srvTcp = kzalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL);
 		if (srvTcp == NULL) {
 			rc = -ENOMEM;
 			sock_release(csocket);
@@ -1765,7 +1765,6 @@ cifs_mount(struct super_block *sb, struc
 			FreeXid(xid);
 			return rc;
 		} else {
-			memset(srvTcp, 0, sizeof (struct TCP_Server_Info));
 			memcpy(&srvTcp->addr.sockAddr, &sin_server, sizeof (struct sockaddr_in));
 			atomic_set(&srvTcp->inFlight,0);
 			/* BB Add code for ipv6 case too */
diff -rubp linux-2.6.19-rc5_orig/fs/dlm/memory.c linux-2.6.19-rc5_kzalloc/fs/dlm/memory.c
--- linux-2.6.19-rc5_orig/fs/dlm/memory.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/dlm/memory.c	2006-11-11 22:44:04.000000000 +0200
@@ -37,12 +37,7 @@ void dlm_memory_exit(void)
 
 char *allocate_lvb(struct dlm_ls *ls)
 {
-	char *p;
-
-	p = kmalloc(ls->ls_lvblen, GFP_KERNEL);
-	if (p)
-		memset(p, 0, ls->ls_lvblen);
-	return p;
+	return kzalloc(ls->ls_lvblen, GFP_KERNEL);
 }
 
 void free_lvb(char *p)
@@ -55,14 +50,9 @@ void free_lvb(char *p)
 
 struct dlm_rsb *allocate_rsb(struct dlm_ls *ls, int namelen)
 {
-	struct dlm_rsb *r;
-
 	DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,);
 
-	r = kmalloc(sizeof(*r) + namelen, GFP_KERNEL);
-	if (r)
-		memset(r, 0, sizeof(*r) + namelen);
-	return r;
+	return kzalloc(sizeof(struct dlm_rsb) + namelen, GFP_KERNEL);
 }
 
 void free_rsb(struct dlm_rsb *r)
@@ -98,15 +88,10 @@ void free_lkb(struct dlm_lkb *lkb)
 
 struct dlm_direntry *allocate_direntry(struct dlm_ls *ls, int namelen)
 {
-	struct dlm_direntry *de;
-
 	DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,
 		   printk("namelen = %d\n", namelen););
 
-	de = kmalloc(sizeof(*de) + namelen, GFP_KERNEL);
-	if (de)
-		memset(de, 0, sizeof(*de) + namelen);
-	return de;
+	return kzalloc(sizeof(struct dlm_direntry) + namelen, GFP_KERNEL);
 }
 
 void free_direntry(struct dlm_direntry *de)
diff -rubp linux-2.6.19-rc5_orig/fs/ext2/super.c linux-2.6.19-rc5_kzalloc/fs/ext2/super.c
--- linux-2.6.19-rc5_orig/fs/ext2/super.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/ext2/super.c	2006-11-11 22:44:04.000000000 +0200
@@ -883,13 +883,12 @@ static int ext2_fill_super(struct super_
 		goto failed_mount;
 	}
 	bgl_lock_init(&sbi->s_blockgroup_lock);
-	sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
+	sbi->s_debts = kzalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
 			       GFP_KERNEL);
 	if (!sbi->s_debts) {
 		printk ("EXT2-fs: not enough memory\n");
 		goto failed_mount_group_desc;
 	}
-	memset(sbi->s_debts, 0, sbi->s_groups_count * sizeof(*sbi->s_debts));
 	for (i = 0; i < db_count; i++) {
 		block = descriptor_loc(sb, logic_sb_block, i);
 		sbi->s_group_desc[i] = sb_bread(sb, block);
diff -rubp linux-2.6.19-rc5_orig/fs/ext3/xattr.c linux-2.6.19-rc5_kzalloc/fs/ext3/xattr.c
--- linux-2.6.19-rc5_orig/fs/ext3/xattr.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/ext3/xattr.c	2006-11-11 22:44:04.000000000 +0200
@@ -733,12 +733,11 @@ ext3_xattr_block_set(handle_t *handle, s
 		}
 	} else {
 		/* Allocate a buffer where we construct the new block. */
-		s->base = kmalloc(sb->s_blocksize, GFP_KERNEL);
+		s->base = kzalloc(sb->s_blocksize, GFP_KERNEL);
 		/* assert(header == s->base) */
 		error = -ENOMEM;
 		if (s->base == NULL)
 			goto cleanup;
-		memset(s->base, 0, sb->s_blocksize);
 		header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC);
 		header(s->base)->h_blocks = cpu_to_le32(1);
 		header(s->base)->h_refcount = cpu_to_le32(1);
diff -rubp linux-2.6.19-rc5_orig/fs/ext4/extents.c linux-2.6.19-rc5_kzalloc/fs/ext4/extents.c
--- linux-2.6.19-rc5_orig/fs/ext4/extents.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/ext4/extents.c	2006-11-11 22:44:04.000000000 +0200
@@ -641,10 +641,9 @@ static int ext4_ext_split(handle_t *hand
 	 * We need this to handle errors and free blocks
 	 * upon them.
 	 */
-	ablocks = kmalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS);
+	ablocks = kzalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS);
 	if (!ablocks)
 		return -ENOMEM;
-	memset(ablocks, 0, sizeof(ext4_fsblk_t) * depth);
 
 	/* allocate all needed blocks */
 	ext_debug("allocate %d blocks for indexes/leaf\n", depth - at);
@@ -1756,12 +1755,11 @@ int ext4_ext_remove_space(struct inode *
 	 * We start scanning from right side, freeing all the blocks
 	 * after i_size and walking into the tree depth-wise.
 	 */
-	path = kmalloc(sizeof(struct ext4_ext_path) * (depth + 1), GFP_KERNEL);
+	path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), GFP_KERNEL);
 	if (path == NULL) {
 		ext4_journal_stop(handle);
 		return -ENOMEM;
 	}
-	memset(path, 0, sizeof(struct ext4_ext_path) * (depth + 1));
 	path[0].p_hdr = ext_inode_hdr(inode);
 	if (ext4_ext_check_header(__FUNCTION__, inode, path[0].p_hdr)) {
 		err = -EIO;
diff -rubp linux-2.6.19-rc5_orig/fs/ext4/xattr.c linux-2.6.19-rc5_kzalloc/fs/ext4/xattr.c
--- linux-2.6.19-rc5_orig/fs/ext4/xattr.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/ext4/xattr.c	2006-11-11 22:44:04.000000000 +0200
@@ -733,12 +733,11 @@ ext4_xattr_block_set(handle_t *handle, s
 		}
 	} else {
 		/* Allocate a buffer where we construct the new block. */
-		s->base = kmalloc(sb->s_blocksize, GFP_KERNEL);
+		s->base = kzalloc(sb->s_blocksize, GFP_KERNEL);
 		/* assert(header == s->base) */
 		error = -ENOMEM;
 		if (s->base == NULL)
 			goto cleanup;
-		memset(s->base, 0, sb->s_blocksize);
 		header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
 		header(s->base)->h_blocks = cpu_to_le32(1);
 		header(s->base)->h_refcount = cpu_to_le32(1);
diff -rubp linux-2.6.19-rc5_orig/fs/jffs/intrep.c linux-2.6.19-rc5_kzalloc/fs/jffs/intrep.c
--- linux-2.6.19-rc5_orig/fs/jffs/intrep.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/jffs/intrep.c	2006-11-11 22:44:18.000000000 +0200
@@ -591,7 +591,7 @@ jffs_add_virtual_root(struct jffs_contro
 	D2(printk("jffs_add_virtual_root(): "
 		  "Creating a virtual root directory.\n"));
 
-	if (!(root = kmalloc(sizeof(struct jffs_file), GFP_KERNEL))) {
+	if (!(root = kzalloc(sizeof(struct jffs_file), GFP_KERNEL))) {
 		return -ENOMEM;
 	}
 	no_jffs_file++;
@@ -603,7 +603,6 @@ jffs_add_virtual_root(struct jffs_contro
 	DJM(no_jffs_node++);
 	memset(node, 0, sizeof(struct jffs_node));
 	node->ino = JFFS_MIN_INO;
-	memset(root, 0, sizeof(struct jffs_file));
 	root->ino = JFFS_MIN_INO;
 	root->mode = S_IFDIR | S_IRWXU | S_IRGRP
 		     | S_IXGRP | S_IROTH | S_IXOTH;
diff -rubp linux-2.6.19-rc5_orig/fs/jffs2/fs.c linux-2.6.19-rc5_kzalloc/fs/jffs2/fs.c
--- linux-2.6.19-rc5_orig/fs/jffs2/fs.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/jffs2/fs.c	2006-11-11 22:44:04.000000000 +0200
@@ -502,12 +502,11 @@ int jffs2_do_fill_super(struct super_blo
 	if (ret)
 		return ret;
 
-	c->inocache_list = kmalloc(INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
+	c->inocache_list = kzalloc(INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
 	if (!c->inocache_list) {
 		ret = -ENOMEM;
 		goto out_wbuf;
 	}
-	memset(c->inocache_list, 0, INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *));
 
 	jffs2_init_xattr_subsystem(c);
 
diff -rubp linux-2.6.19-rc5_orig/fs/jffs2/readinode.c linux-2.6.19-rc5_kzalloc/fs/jffs2/readinode.c
--- linux-2.6.19-rc5_orig/fs/jffs2/readinode.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/jffs2/readinode.c	2006-11-11 22:44:04.000000000 +0200
@@ -944,13 +944,12 @@ int jffs2_do_read_inode(struct jffs2_sb_
 int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic)
 {
 	struct jffs2_raw_inode n;
-	struct jffs2_inode_info *f = kmalloc(sizeof(*f), GFP_KERNEL);
+	struct jffs2_inode_info *f = kzalloc(sizeof(*f), GFP_KERNEL);
 	int ret;
 
 	if (!f)
 		return -ENOMEM;
 
-	memset(f, 0, sizeof(*f));
 	init_MUTEX_LOCKED(&f->sem);
 	f->inocache = ic;
 
diff -rubp linux-2.6.19-rc5_orig/fs/jffs2/scan.c linux-2.6.19-rc5_kzalloc/fs/jffs2/scan.c
--- linux-2.6.19-rc5_orig/fs/jffs2/scan.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/jffs2/scan.c	2006-11-11 22:44:04.000000000 +0200
@@ -128,12 +128,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
 	}
 
 	if (jffs2_sum_active()) {
-		s = kmalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
+		s = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
 		if (!s) {
 			JFFS2_WARNING("Can't allocate memory for summary\n");
 			return -ENOMEM;
 		}
-		memset(s, 0, sizeof(struct jffs2_summary));
 	}
 
 	for (i=0; i<c->nr_blocks; i++) {
diff -rubp linux-2.6.19-rc5_orig/fs/jffs2/summary.c linux-2.6.19-rc5_kzalloc/fs/jffs2/summary.c
--- linux-2.6.19-rc5_orig/fs/jffs2/summary.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/jffs2/summary.c	2006-11-11 22:44:04.000000000 +0200
@@ -26,15 +26,13 @@
 
 int jffs2_sum_init(struct jffs2_sb_info *c)
 {
-	c->summary = kmalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
+	c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
 
 	if (!c->summary) {
 		JFFS2_WARNING("Can't allocate memory for summary information!\n");
 		return -ENOMEM;
 	}
 
-	memset(c->summary, 0, sizeof(struct jffs2_summary));
-
 	c->summary->sum_buf = vmalloc(c->sector_size);
 
 	if (!c->summary->sum_buf) {
diff -rubp linux-2.6.19-rc5_orig/fs/nfsd/nfscache.c linux-2.6.19-rc5_kzalloc/fs/nfsd/nfscache.c
--- linux-2.6.19-rc5_orig/fs/nfsd/nfscache.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/nfsd/nfscache.c	2006-11-11 22:44:04.000000000 +0200
@@ -66,14 +66,13 @@ nfsd_cache_init(void)
 		printk (KERN_ERR "nfsd: cannot allocate all %d cache entries, only got %d\n",
 			CACHESIZE, CACHESIZE-i);
 
-	hash_list = kmalloc (HASHSIZE * sizeof(struct hlist_head), GFP_KERNEL);
+	hash_list = kzalloc (HASHSIZE * sizeof(struct hlist_head), GFP_KERNEL);
 	if (!hash_list) {
 		nfsd_cache_shutdown();
 		printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n",
 			HASHSIZE * sizeof(struct hlist_head));
 		return;
 	}
-	memset(hash_list, 0, HASHSIZE * sizeof(struct hlist_head));
 
 	cache_disabled = 0;
 }
diff -rubp linux-2.6.19-rc5_orig/fs/nfsd/vfs.c linux-2.6.19-rc5_kzalloc/fs/nfsd/vfs.c
--- linux-2.6.19-rc5_orig/fs/nfsd/vfs.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/nfsd/vfs.c	2006-11-11 22:44:18.000000000 +0200
@@ -1883,7 +1883,7 @@ nfsd_racache_init(int cache_size)
 		return 0;
 	if (cache_size < 2*RAPARM_HASH_SIZE)
 		cache_size = 2*RAPARM_HASH_SIZE;
-	raparml = kmalloc(sizeof(struct raparms) * cache_size, GFP_KERNEL);
+	raparml = kzalloc(sizeof(struct raparms) * cache_size, GFP_KERNEL);
 
 	if (raparml != NULL) {
 		dprintk("nfsd: allocating %d readahead buffers.\n",
@@ -1893,7 +1893,6 @@ nfsd_racache_init(int cache_size)
 			spin_lock_init(&raparm_hash[i].pb_lock);
 		}
 		nperbucket = cache_size >> RAPARM_HASH_BITS;
-		memset(raparml, 0, sizeof(struct raparms) * cache_size);
 		for (i = 0; i < cache_size - 1; i++) {
 			if (i % nperbucket == 0)
 				raparm_hash[j++].pb_head = raparml + i;
diff -rubp linux-2.6.19-rc5_orig/fs/partitions/check.c linux-2.6.19-rc5_kzalloc/fs/partitions/check.c
--- linux-2.6.19-rc5_orig/fs/partitions/check.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/partitions/check.c	2006-11-11 22:44:04.000000000 +0200
@@ -331,11 +331,10 @@ void add_partition(struct gendisk *disk,
 {
 	struct hd_struct *p;
 
-	p = kmalloc(sizeof(*p), GFP_KERNEL);
+	p = kzalloc(sizeof(*p), GFP_KERNEL);
 	if (!p)
 		return;
 	
-	memset(p, 0, sizeof(*p));
 	p->start_sect = start;
 	p->nr_sects = len;
 	p->partno = part;
diff -rubp linux-2.6.19-rc5_orig/fs/proc/vmcore.c linux-2.6.19-rc5_kzalloc/fs/proc/vmcore.c
--- linux-2.6.19-rc5_orig/fs/proc/vmcore.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/proc/vmcore.c	2006-11-11 22:44:04.000000000 +0200
@@ -178,12 +178,7 @@ const struct file_operations proc_vmcore
 
 static struct vmcore* __init get_new_element(void)
 {
-	struct vmcore *p;
-
-	p = kmalloc(sizeof(*p), GFP_KERNEL);
-	if (p)
-		memset(p, 0, sizeof(*p));
-	return p;
+	return kzalloc(sizeof(*p), GFP_KERNEL);
 }
 
 static u64 __init get_vmcore_size_elf64(char *elfptr)
diff -rubp linux-2.6.19-rc5_orig/fs/reiserfs/file.c linux-2.6.19-rc5_kzalloc/fs/reiserfs/file.c
--- linux-2.6.19-rc5_orig/fs/reiserfs/file.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/reiserfs/file.c	2006-11-11 22:44:04.000000000 +0200
@@ -316,12 +316,11 @@ static int reiserfs_allocate_blocks_for_
 			/* area filled with zeroes, to supply as list of zero blocknumbers
 			   We allocate it outside of loop just in case loop would spin for
 			   several iterations. */
-			char *zeros = kmalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC);	// We cannot insert more than MAX_ITEM_LEN bytes anyway.
+			char *zeros = kzalloc(to_paste * UNFM_P_SIZE, GFP_ATOMIC);	// We cannot insert more than MAX_ITEM_LEN bytes anyway.
 			if (!zeros) {
 				res = -ENOMEM;
 				goto error_exit_free_blocks;
 			}
-			memset(zeros, 0, to_paste * UNFM_P_SIZE);
 			do {
 				to_paste =
 				    min_t(__u64, hole_size,
diff -rubp linux-2.6.19-rc5_orig/fs/reiserfs/inode.c linux-2.6.19-rc5_kzalloc/fs/reiserfs/inode.c
--- linux-2.6.19-rc5_orig/fs/reiserfs/inode.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/reiserfs/inode.c	2006-11-11 22:44:04.000000000 +0200
@@ -928,15 +928,12 @@ int reiserfs_get_block(struct inode *ino
 			if (blocks_needed == 1) {
 				un = &unf_single;
 			} else {
-				un = kmalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC);	// We need to avoid scheduling.
+				un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_ATOMIC);	// We need to avoid scheduling.
 				if (!un) {
 					un = &unf_single;
 					blocks_needed = 1;
 					max_to_insert = 0;
-				} else
-					memset(un, 0,
-					       UNFM_P_SIZE * min(blocks_needed,
-								 max_to_insert));
+				}
 			}
 			if (blocks_needed <= max_to_insert) {
 				/* we are going to add target block to the file. Use allocated
diff -rubp linux-2.6.19-rc5_orig/fs/reiserfs/super.c linux-2.6.19-rc5_kzalloc/fs/reiserfs/super.c
--- linux-2.6.19-rc5_orig/fs/reiserfs/super.c	2006-11-09 12:16:20.000000000 +0200
+++ linux-2.6.19-rc5_kzalloc/fs/reiserfs/super.c	2006-11-11 22:44:04.000000000 +0200
@@ -1549,13 +1549,12 @@ static int reiserfs_fill_super(struct su
 	struct reiserfs_sb_info *sbi;
 	int errval = -EINVAL;
 
-	sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
+	sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);
 	if (!sbi) {
 		errval = -ENOMEM;
 		goto error;
 	}
 	s->s_fs_info = sbi;
-	memset(sbi, 0, sizeof(struct reiserfs_sb_info));
 	/* Set default values for options: non-aggressive tails, RO on errors */
 	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);
 	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);
