aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/adfs/super.c3
-rw-r--r--fs/affs/super.c3
-rw-r--r--fs/afs/vlocation.c3
-rw-r--r--fs/afs/volume.c3
-rw-r--r--fs/autofs/inode.c3
-rw-r--r--fs/bfs/inode.c6
-rw-r--r--fs/configfs/file.c3
-rw-r--r--fs/configfs/inode.c3
-rw-r--r--fs/cramfs/inode.c3
-rw-r--r--fs/efs/super.c3
-rw-r--r--fs/ext2/super.c3
-rw-r--r--fs/ext2/xattr.c3
-rw-r--r--fs/ext3/dir.c3
-rw-r--r--fs/ext3/super.c3
-rw-r--r--fs/fat/inode.c3
-rw-r--r--fs/hfs/bnode.c3
-rw-r--r--fs/hfs/btree.c3
-rw-r--r--fs/hfs/super.c3
-rw-r--r--fs/hfsplus/bnode.c3
-rw-r--r--fs/hfsplus/btree.c3
-rw-r--r--fs/hpfs/super.c3
-rw-r--r--fs/isofs/inode.c3
-rw-r--r--fs/jffs2/super.c3
-rw-r--r--fs/lockd/host.c4
-rw-r--r--fs/lockd/svcsubs.c3
-rw-r--r--fs/minix/inode.c6
-rw-r--r--fs/ncpfs/inode.c3
-rw-r--r--fs/nfsd/nfs4idmap.c3
-rw-r--r--fs/nfsd/nfs4state.c3
-rw-r--r--fs/partitions/efi.c9
-rw-r--r--fs/proc/kcore.c6
-rw-r--r--fs/qnx4/inode.c3
-rw-r--r--fs/sysv/super.c6
-rw-r--r--fs/udf/ialloc.c6
-rw-r--r--fs/ufs/super.c3
35 files changed, 43 insertions, 84 deletions
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 82011019494c..959dbf1f8e63 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -339,11 +339,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
339 339
340 sb->s_flags |= MS_NODIRATIME; 340 sb->s_flags |= MS_NODIRATIME;
341 341
342 asb = kmalloc(sizeof(*asb), GFP_KERNEL); 342 asb = kzalloc(sizeof(*asb), GFP_KERNEL);
343 if (!asb) 343 if (!asb)
344 return -ENOMEM; 344 return -ENOMEM;
345 sb->s_fs_info = asb; 345 sb->s_fs_info = asb;
346 memset(asb, 0, sizeof(*asb));
347 346
348 /* set default options */ 347 /* set default options */
349 asb->s_uid = 0; 348 asb->s_uid = 0;
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 17352011ab67..b35f514479bf 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -280,11 +280,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
280 sb->s_op = &affs_sops; 280 sb->s_op = &affs_sops;
281 sb->s_flags |= MS_NODIRATIME; 281 sb->s_flags |= MS_NODIRATIME;
282 282
283 sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL); 283 sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
284 if (!sbi) 284 if (!sbi)
285 return -ENOMEM; 285 return -ENOMEM;
286 sb->s_fs_info = sbi; 286 sb->s_fs_info = sbi;
287 memset(sbi, 0, sizeof(*sbi));
288 init_MUTEX(&sbi->s_bmlock); 287 init_MUTEX(&sbi->s_bmlock);
289 288
290 if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, 289 if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index 331f730a1fb3..782ee7c600ca 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -281,11 +281,10 @@ int afs_vlocation_lookup(struct afs_cell *cell,
281 spin_unlock(&cell->vl_gylock); 281 spin_unlock(&cell->vl_gylock);
282 282
283 /* not in the cell's in-memory lists - create a new record */ 283 /* not in the cell's in-memory lists - create a new record */
284 vlocation = kmalloc(sizeof(struct afs_vlocation), GFP_KERNEL); 284 vlocation = kzalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
285 if (!vlocation) 285 if (!vlocation)
286 return -ENOMEM; 286 return -ENOMEM;
287 287
288 memset(vlocation, 0, sizeof(struct afs_vlocation));
289 atomic_set(&vlocation->usage, 1); 288 atomic_set(&vlocation->usage, 1);
290 INIT_LIST_HEAD(&vlocation->link); 289 INIT_LIST_HEAD(&vlocation->link);
291 rwlock_init(&vlocation->lock); 290 rwlock_init(&vlocation->lock);
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index 0ff4b86476e3..768c6dbd323a 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -186,11 +186,10 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
186 _debug("creating new volume record"); 186 _debug("creating new volume record");
187 187
188 ret = -ENOMEM; 188 ret = -ENOMEM;
189 volume = kmalloc(sizeof(struct afs_volume), GFP_KERNEL); 189 volume = kzalloc(sizeof(struct afs_volume), GFP_KERNEL);
190 if (!volume) 190 if (!volume)
191 goto error_up; 191 goto error_up;
192 192
193 memset(volume, 0, sizeof(struct afs_volume));
194 atomic_set(&volume->usage, 1); 193 atomic_set(&volume->usage, 1);
195 volume->type = type; 194 volume->type = type;
196 volume->type_force = force; 195 volume->type_force = force;
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index af2efbbb5d76..c81d6b8c2828 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -129,10 +129,9 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
129 struct autofs_sb_info *sbi; 129 struct autofs_sb_info *sbi;
130 int minproto, maxproto; 130 int minproto, maxproto;
131 131
132 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 132 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
133 if ( !sbi ) 133 if ( !sbi )
134 goto fail_unlock; 134 goto fail_unlock;
135 memset(sbi, 0, sizeof(*sbi));
136 DPRINTK(("autofs: starting up, sbi = %p\n",sbi)); 135 DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
137 136
138 s->s_fs_info = sbi; 137 s->s_fs_info = sbi;
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index cf74f3d4d966..3e4d6c767b9b 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -311,11 +311,10 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
311 unsigned i, imap_len; 311 unsigned i, imap_len;
312 struct bfs_sb_info * info; 312 struct bfs_sb_info * info;
313 313
314 info = kmalloc(sizeof(*info), GFP_KERNEL); 314 info = kzalloc(sizeof(*info), GFP_KERNEL);
315 if (!info) 315 if (!info)
316 return -ENOMEM; 316 return -ENOMEM;
317 s->s_fs_info = info; 317 s->s_fs_info = info;
318 memset(info, 0, sizeof(*info));
319 318
320 sb_set_blocksize(s, BFS_BSIZE); 319 sb_set_blocksize(s, BFS_BSIZE);
321 320
@@ -338,10 +337,9 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
338 + BFS_ROOT_INO - 1; 337 + BFS_ROOT_INO - 1;
339 338
340 imap_len = info->si_lasti/8 + 1; 339 imap_len = info->si_lasti/8 + 1;
341 info->si_imap = kmalloc(imap_len, GFP_KERNEL); 340 info->si_imap = kzalloc(imap_len, GFP_KERNEL);
342 if (!info->si_imap) 341 if (!info->si_imap)
343 goto out; 342 goto out;
344 memset(info->si_imap, 0, imap_len);
345 for (i=0; i<BFS_ROOT_INO; i++) 343 for (i=0; i<BFS_ROOT_INO; i++)
346 set_bit(i, info->si_imap); 344 set_bit(i, info->si_imap);
347 345
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index f499803743e0..85105e50f7db 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -274,9 +274,8 @@ static int check_perm(struct inode * inode, struct file * file)
274 /* No error? Great, allocate a buffer for the file, and store it 274 /* No error? Great, allocate a buffer for the file, and store it
275 * it in file->private_data for easy access. 275 * it in file->private_data for easy access.
276 */ 276 */
277 buffer = kmalloc(sizeof(struct configfs_buffer),GFP_KERNEL); 277 buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
278 if (buffer) { 278 if (buffer) {
279 memset(buffer,0,sizeof(struct configfs_buffer));
280 init_MUTEX(&buffer->sem); 279 init_MUTEX(&buffer->sem);
281 buffer->needs_read_fill = 1; 280 buffer->needs_read_fill = 1;
282 buffer->ops = ops; 281 buffer->ops = ops;
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index e14488ca6411..5047e6a7581e 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -76,11 +76,10 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
76 76
77 if (!sd_iattr) { 77 if (!sd_iattr) {
78 /* setting attributes for the first time, allocate now */ 78 /* setting attributes for the first time, allocate now */
79 sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); 79 sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);
80 if (!sd_iattr) 80 if (!sd_iattr)
81 return -ENOMEM; 81 return -ENOMEM;
82 /* assign default attributes */ 82 /* assign default attributes */
83 memset(sd_iattr, 0, sizeof(struct iattr));
84 sd_iattr->ia_mode = sd->s_mode; 83 sd_iattr->ia_mode = sd->s_mode;
85 sd_iattr->ia_uid = 0; 84 sd_iattr->ia_uid = 0;
86 sd_iattr->ia_gid = 0; 85 sd_iattr->ia_gid = 0;
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 223c0431042d..d09b6777c41a 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -242,11 +242,10 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
242 242
243 sb->s_flags |= MS_RDONLY; 243 sb->s_flags |= MS_RDONLY;
244 244
245 sbi = kmalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL); 245 sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
246 if (!sbi) 246 if (!sbi)
247 return -ENOMEM; 247 return -ENOMEM;
248 sb->s_fs_info = sbi; 248 sb->s_fs_info = sbi;
249 memset(sbi, 0, sizeof(struct cramfs_sb_info));
250 249
251 /* Invalidate the read buffers on mount: think disk change.. */ 250 /* Invalidate the read buffers on mount: think disk change.. */
252 mutex_lock(&read_mutex); 251 mutex_lock(&read_mutex);
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 8ac2462ae5dd..7089269ee9ae 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -248,11 +248,10 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
248 struct buffer_head *bh; 248 struct buffer_head *bh;
249 struct inode *root; 249 struct inode *root;
250 250
251 sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL); 251 sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
252 if (!sb) 252 if (!sb)
253 return -ENOMEM; 253 return -ENOMEM;
254 s->s_fs_info = sb; 254 s->s_fs_info = sb;
255 memset(sb, 0, sizeof(struct efs_sb_info));
256 255
257 s->s_magic = EFS_SUPER_MAGIC; 256 s->s_magic = EFS_SUPER_MAGIC;
258 if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) { 257 if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d978d3febb8c..69435fbe53f2 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -655,11 +655,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
655 int i, j; 655 int i, j;
656 __le32 features; 656 __le32 features;
657 657
658 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 658 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
659 if (!sbi) 659 if (!sbi)
660 return -ENOMEM; 660 return -ENOMEM;
661 sb->s_fs_info = sbi; 661 sb->s_fs_info = sbi;
662 memset(sbi, 0, sizeof(*sbi));
663 662
664 /* 663 /*
665 * See what the current blocksize for the device is, and 664 * See what the current blocksize for the device is, and
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 86ae8e93adb9..af52a7f8b291 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -521,11 +521,10 @@ bad_block: ext2_error(sb, "ext2_xattr_set",
521 } 521 }
522 } else { 522 } else {
523 /* Allocate a buffer where we construct the new block. */ 523 /* Allocate a buffer where we construct the new block. */
524 header = kmalloc(sb->s_blocksize, GFP_KERNEL); 524 header = kzalloc(sb->s_blocksize, GFP_KERNEL);
525 error = -ENOMEM; 525 error = -ENOMEM;
526 if (header == NULL) 526 if (header == NULL)
527 goto cleanup; 527 goto cleanup;
528 memset(header, 0, sb->s_blocksize);
529 end = (char *)header + sb->s_blocksize; 528 end = (char *)header + sb->s_blocksize;
530 header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC); 529 header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC);
531 header->h_blocks = header->h_refcount = cpu_to_le32(1); 530 header->h_blocks = header->h_refcount = cpu_to_le32(1);
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 4d97f437cd48..429acbb4e064 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -343,10 +343,9 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
343 343
344 /* Create and allocate the fname structure */ 344 /* Create and allocate the fname structure */
345 len = sizeof(struct fname) + dirent->name_len + 1; 345 len = sizeof(struct fname) + dirent->name_len + 1;
346 new_fn = kmalloc(len, GFP_KERNEL); 346 new_fn = kzalloc(len, GFP_KERNEL);
347 if (!new_fn) 347 if (!new_fn)
348 return -ENOMEM; 348 return -ENOMEM;
349 memset(new_fn, 0, len);
350 new_fn->hash = hash; 349 new_fn->hash = hash;
351 new_fn->minor_hash = minor_hash; 350 new_fn->minor_hash = minor_hash;
352 new_fn->inode = le32_to_cpu(dirent->inode); 351 new_fn->inode = le32_to_cpu(dirent->inode);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 10985017765b..09b4b313ca07 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1407,11 +1407,10 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1407 int needs_recovery; 1407 int needs_recovery;
1408 __le32 features; 1408 __le32 features;
1409 1409
1410 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 1410 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
1411 if (!sbi) 1411 if (!sbi)
1412 return -ENOMEM; 1412 return -ENOMEM;
1413 sb->s_fs_info = sbi; 1413 sb->s_fs_info = sbi;
1414 memset(sbi, 0, sizeof(*sbi));
1415 sbi->s_mount_opt = 0; 1414 sbi->s_mount_opt = 0;
1416 sbi->s_resuid = EXT3_DEF_RESUID; 1415 sbi->s_resuid = EXT3_DEF_RESUID;
1417 sbi->s_resgid = EXT3_DEF_RESGID; 1416 sbi->s_resgid = EXT3_DEF_RESGID;
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 31b7174176ba..bc4da3a48c8c 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1168,11 +1168,10 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
1168 long error; 1168 long error;
1169 char buf[50]; 1169 char buf[50];
1170 1170
1171 sbi = kmalloc(sizeof(struct msdos_sb_info), GFP_KERNEL); 1171 sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL);
1172 if (!sbi) 1172 if (!sbi)
1173 return -ENOMEM; 1173 return -ENOMEM;
1174 sb->s_fs_info = sbi; 1174 sb->s_fs_info = sbi;
1175 memset(sbi, 0, sizeof(struct msdos_sb_info));
1176 1175
1177 sb->s_flags |= MS_NODIRATIME; 1176 sb->s_flags |= MS_NODIRATIME;
1178 sb->s_magic = MSDOS_SUPER_MAGIC; 1177 sb->s_magic = MSDOS_SUPER_MAGIC;
diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c
index 13231dd5ce66..0d200068d0af 100644
--- a/fs/hfs/bnode.c
+++ b/fs/hfs/bnode.c
@@ -249,10 +249,9 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
249 sb = tree->inode->i_sb; 249 sb = tree->inode->i_sb;
250 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * 250 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
251 sizeof(struct page *); 251 sizeof(struct page *);
252 node = kmalloc(size, GFP_KERNEL); 252 node = kzalloc(size, GFP_KERNEL);
253 if (!node) 253 if (!node)
254 return NULL; 254 return NULL;
255 memset(node, 0, size);
256 node->tree = tree; 255 node->tree = tree;
257 node->this = cnid; 256 node->this = cnid;
258 set_bit(HFS_BNODE_NEW, &node->flags); 257 set_bit(HFS_BNODE_NEW, &node->flags);
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 400357994319..5fd0ed71f923 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -21,10 +21,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
21 struct page *page; 21 struct page *page;
22 unsigned int size; 22 unsigned int size;
23 23
24 tree = kmalloc(sizeof(*tree), GFP_KERNEL); 24 tree = kzalloc(sizeof(*tree), GFP_KERNEL);
25 if (!tree) 25 if (!tree)
26 return NULL; 26 return NULL;
27 memset(tree, 0, sizeof(*tree));
28 27
29 init_MUTEX(&tree->tree_lock); 28 init_MUTEX(&tree->tree_lock);
30 spin_lock_init(&tree->hash_lock); 29 spin_lock_init(&tree->hash_lock);
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index 34937ee83ab1..05dffff1a372 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -356,11 +356,10 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
356 struct inode *root_inode; 356 struct inode *root_inode;
357 int res; 357 int res;
358 358
359 sbi = kmalloc(sizeof(struct hfs_sb_info), GFP_KERNEL); 359 sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
360 if (!sbi) 360 if (!sbi)
361 return -ENOMEM; 361 return -ENOMEM;
362 sb->s_fs_info = sbi; 362 sb->s_fs_info = sbi;
363 memset(sbi, 0, sizeof(struct hfs_sb_info));
364 INIT_HLIST_HEAD(&sbi->rsrc_inodes); 363 INIT_HLIST_HEAD(&sbi->rsrc_inodes);
365 364
366 res = -EINVAL; 365 res = -EINVAL;
diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c
index 77bf434da679..29da6574ba77 100644
--- a/fs/hfsplus/bnode.c
+++ b/fs/hfsplus/bnode.c
@@ -409,10 +409,9 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
409 sb = tree->inode->i_sb; 409 sb = tree->inode->i_sb;
410 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode * 410 size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
411 sizeof(struct page *); 411 sizeof(struct page *);
412 node = kmalloc(size, GFP_KERNEL); 412 node = kzalloc(size, GFP_KERNEL);
413 if (!node) 413 if (!node)
414 return NULL; 414 return NULL;
415 memset(node, 0, size);
416 node->tree = tree; 415 node->tree = tree;
417 node->this = cnid; 416 node->this = cnid;
418 set_bit(HFS_BNODE_NEW, &node->flags); 417 set_bit(HFS_BNODE_NEW, &node->flags);
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index cfc852fdd1b5..a9b9e872e29a 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -24,10 +24,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
24 struct page *page; 24 struct page *page;
25 unsigned int size; 25 unsigned int size;
26 26
27 tree = kmalloc(sizeof(*tree), GFP_KERNEL); 27 tree = kzalloc(sizeof(*tree), GFP_KERNEL);
28 if (!tree) 28 if (!tree)
29 return NULL; 29 return NULL;
30 memset(tree, 0, sizeof(*tree));
31 30
32 init_MUTEX(&tree->tree_lock); 31 init_MUTEX(&tree->tree_lock);
33 spin_lock_init(&tree->hash_lock); 32 spin_lock_init(&tree->hash_lock);
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 8fe51c343786..b76d60832375 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -462,11 +462,10 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
462 462
463 int o; 463 int o;
464 464
465 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 465 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
466 if (!sbi) 466 if (!sbi)
467 return -ENOMEM; 467 return -ENOMEM;
468 s->s_fs_info = sbi; 468 s->s_fs_info = sbi;
469 memset(sbi, 0, sizeof(*sbi));
470 469
471 sbi->sb_bmp_dir = NULL; 470 sbi->sb_bmp_dir = NULL;
472 sbi->sb_cp_table = NULL; 471 sbi->sb_cp_table = NULL;
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 14391361c886..ab15e9072151 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -557,11 +557,10 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
557 struct iso9660_options opt; 557 struct iso9660_options opt;
558 struct isofs_sb_info * sbi; 558 struct isofs_sb_info * sbi;
559 559
560 sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 560 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
561 if (!sbi) 561 if (!sbi)
562 return -ENOMEM; 562 return -ENOMEM;
563 s->s_fs_info = sbi; 563 s->s_fs_info = sbi;
564 memset(sbi, 0, sizeof(*sbi));
565 564
566 if (!parse_options((char *)data, &opt)) 565 if (!parse_options((char *)data, &opt))
567 goto out_freesbi; 566 goto out_freesbi;
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 68e3953419b4..6de374513c01 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -119,10 +119,9 @@ static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
119 struct jffs2_sb_info *c; 119 struct jffs2_sb_info *c;
120 int ret; 120 int ret;
121 121
122 c = kmalloc(sizeof(*c), GFP_KERNEL); 122 c = kzalloc(sizeof(*c), GFP_KERNEL);
123 if (!c) 123 if (!c)
124 return -ENOMEM; 124 return -ENOMEM;
125 memset(c, 0, sizeof(*c));
126 c->mtd = mtd; 125 c->mtd = mtd;
127 126
128 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c); 127 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c);
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 703fb038c813..a0d0b58ce7a4 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -99,9 +99,9 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
99 /* Ooops, no host found, create it */ 99 /* Ooops, no host found, create it */
100 dprintk("lockd: creating host entry\n"); 100 dprintk("lockd: creating host entry\n");
101 101
102 if (!(host = (struct nlm_host *) kmalloc(sizeof(*host), GFP_KERNEL))) 102 host = kzalloc(sizeof(*host), GFP_KERNEL);
103 if (!host)
103 goto nohost; 104 goto nohost;
104 memset(host, 0, sizeof(*host));
105 105
106 addr = sin->sin_addr.s_addr; 106 addr = sin->sin_addr.s_addr;
107 sprintf(host->h_name, "%u.%u.%u.%u", NIPQUAD(addr)); 107 sprintf(host->h_name, "%u.%u.%u.%u", NIPQUAD(addr));
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 01b4db9e5466..a92dd98f8401 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -100,11 +100,10 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
100 nlm_debug_print_fh("creating file for", f); 100 nlm_debug_print_fh("creating file for", f);
101 101
102 nfserr = nlm_lck_denied_nolocks; 102 nfserr = nlm_lck_denied_nolocks;
103 file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL); 103 file = kzalloc(sizeof(*file), GFP_KERNEL);
104 if (!file) 104 if (!file)
105 goto out_unlock; 105 goto out_unlock;
106 106
107 memset(file, 0, sizeof(*file));
108 memcpy(&file->f_handle, f, sizeof(struct nfs_fh)); 107 memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
109 file->f_hash = hash; 108 file->f_hash = hash;
110 init_MUTEX(&file->f_sema); 109 init_MUTEX(&file->f_sema);
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 330ff9fc7cf0..e24be7fc0651 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -145,11 +145,10 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
145 struct inode *root_inode; 145 struct inode *root_inode;
146 struct minix_sb_info *sbi; 146 struct minix_sb_info *sbi;
147 147
148 sbi = kmalloc(sizeof(struct minix_sb_info), GFP_KERNEL); 148 sbi = kzalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
149 if (!sbi) 149 if (!sbi)
150 return -ENOMEM; 150 return -ENOMEM;
151 s->s_fs_info = sbi; 151 s->s_fs_info = sbi;
152 memset(sbi, 0, sizeof(struct minix_sb_info));
153 152
154 /* N.B. These should be compile-time tests. 153 /* N.B. These should be compile-time tests.
155 Unfortunately that is impossible. */ 154 Unfortunately that is impossible. */
@@ -207,10 +206,9 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
207 if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0) 206 if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0)
208 goto out_illegal_sb; 207 goto out_illegal_sb;
209 i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh); 208 i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh);
210 map = kmalloc(i, GFP_KERNEL); 209 map = kzalloc(i, GFP_KERNEL);
211 if (!map) 210 if (!map)
212 goto out_no_map; 211 goto out_no_map;
213 memset(map, 0, i);
214 sbi->s_imap = &map[0]; 212 sbi->s_imap = &map[0];
215 sbi->s_zmap = &map[sbi->s_imap_blocks]; 213 sbi->s_zmap = &map[sbi->s_imap_blocks];
216 214
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 1ddf77b0b825..752f02e43ab0 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -411,11 +411,10 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
411#endif 411#endif
412 struct ncp_entry_info finfo; 412 struct ncp_entry_info finfo;
413 413
414 server = kmalloc(sizeof(struct ncp_server), GFP_KERNEL); 414 server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL);
415 if (!server) 415 if (!server)
416 return -ENOMEM; 416 return -ENOMEM;
417 sb->s_fs_info = server; 417 sb->s_fs_info = server;
418 memset(server, 0, sizeof(struct ncp_server));
419 418
420 error = -EFAULT; 419 error = -EFAULT;
421 if (raw_data == NULL) 420 if (raw_data == NULL)
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index bea6b9478114..b1902ebaab41 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -573,10 +573,9 @@ idmap_lookup(struct svc_rqst *rqstp,
573 struct idmap_defer_req *mdr; 573 struct idmap_defer_req *mdr;
574 int ret; 574 int ret;
575 575
576 mdr = kmalloc(sizeof(*mdr), GFP_KERNEL); 576 mdr = kzalloc(sizeof(*mdr), GFP_KERNEL);
577 if (!mdr) 577 if (!mdr)
578 return -ENOMEM; 578 return -ENOMEM;
579 memset(mdr, 0, sizeof(*mdr));
580 atomic_set(&mdr->count, 1); 579 atomic_set(&mdr->count, 1);
581 init_waitqueue_head(&mdr->waitq); 580 init_waitqueue_head(&mdr->waitq);
582 mdr->req.defer = idmap_defer; 581 mdr->req.defer = idmap_defer;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9daa0b9feb8d..1a25c01ecdf1 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -339,8 +339,7 @@ alloc_client(struct xdr_netobj name)
339{ 339{
340 struct nfs4_client *clp; 340 struct nfs4_client *clp;
341 341
342 if ((clp = kmalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) { 342 if ((clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) {
343 memset(clp, 0, sizeof(*clp));
344 if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) { 343 if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) {
345 memcpy(clp->cl_name.data, name.data, name.len); 344 memcpy(clp->cl_name.data, name.data, name.len);
346 clp->cl_name.len = name.len; 345 clp->cl_name.len = name.len;
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 63730282ad81..1bea610078b3 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -238,10 +238,9 @@ alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
238 le32_to_cpu(gpt->sizeof_partition_entry); 238 le32_to_cpu(gpt->sizeof_partition_entry);
239 if (!count) 239 if (!count)
240 return NULL; 240 return NULL;
241 pte = kmalloc(count, GFP_KERNEL); 241 pte = kzalloc(count, GFP_KERNEL);
242 if (!pte) 242 if (!pte)
243 return NULL; 243 return NULL;
244 memset(pte, 0, count);
245 244
246 if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba), 245 if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba),
247 (u8 *) pte, 246 (u8 *) pte,
@@ -269,10 +268,9 @@ alloc_read_gpt_header(struct block_device *bdev, u64 lba)
269 if (!bdev) 268 if (!bdev)
270 return NULL; 269 return NULL;
271 270
272 gpt = kmalloc(sizeof (gpt_header), GFP_KERNEL); 271 gpt = kzalloc(sizeof (gpt_header), GFP_KERNEL);
273 if (!gpt) 272 if (!gpt)
274 return NULL; 273 return NULL;
275 memset(gpt, 0, sizeof (gpt_header));
276 274
277 if (read_lba(bdev, lba, (u8 *) gpt, 275 if (read_lba(bdev, lba, (u8 *) gpt,
278 sizeof (gpt_header)) < sizeof (gpt_header)) { 276 sizeof (gpt_header)) < sizeof (gpt_header)) {
@@ -526,9 +524,8 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
526 lastlba = last_lba(bdev); 524 lastlba = last_lba(bdev);
527 if (!force_gpt) { 525 if (!force_gpt) {
528 /* This will be added to the EFI Spec. per Intel after v1.02. */ 526 /* This will be added to the EFI Spec. per Intel after v1.02. */
529 legacymbr = kmalloc(sizeof (*legacymbr), GFP_KERNEL); 527 legacymbr = kzalloc(sizeof (*legacymbr), GFP_KERNEL);
530 if (legacymbr) { 528 if (legacymbr) {
531 memset(legacymbr, 0, sizeof (*legacymbr));
532 read_lba(bdev, 0, (u8 *) legacymbr, 529 read_lba(bdev, 0, (u8 *) legacymbr,
533 sizeof (*legacymbr)); 530 sizeof (*legacymbr));
534 good_pmbr = is_pmbr_valid(legacymbr, lastlba); 531 good_pmbr = is_pmbr_valid(legacymbr, lastlba);
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 6a984f64edd7..3ceff3857272 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -279,12 +279,11 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
279 tsz = elf_buflen - *fpos; 279 tsz = elf_buflen - *fpos;
280 if (buflen < tsz) 280 if (buflen < tsz)
281 tsz = buflen; 281 tsz = buflen;
282 elf_buf = kmalloc(elf_buflen, GFP_ATOMIC); 282 elf_buf = kzalloc(elf_buflen, GFP_ATOMIC);
283 if (!elf_buf) { 283 if (!elf_buf) {
284 read_unlock(&kclist_lock); 284 read_unlock(&kclist_lock);
285 return -ENOMEM; 285 return -ENOMEM;
286 } 286 }
287 memset(elf_buf, 0, elf_buflen);
288 elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen); 287 elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen);
289 read_unlock(&kclist_lock); 288 read_unlock(&kclist_lock);
290 if (copy_to_user(buffer, elf_buf + *fpos, tsz)) { 289 if (copy_to_user(buffer, elf_buf + *fpos, tsz)) {
@@ -330,10 +329,9 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
330 unsigned long curstart = start; 329 unsigned long curstart = start;
331 unsigned long cursize = tsz; 330 unsigned long cursize = tsz;
332 331
333 elf_buf = kmalloc(tsz, GFP_KERNEL); 332 elf_buf = kzalloc(tsz, GFP_KERNEL);
334 if (!elf_buf) 333 if (!elf_buf)
335 return -ENOMEM; 334 return -ENOMEM;
336 memset(elf_buf, 0, tsz);
337 335
338 read_lock(&vmlist_lock); 336 read_lock(&vmlist_lock);
339 for (m=vmlist; m && cursize; m=m->next) { 337 for (m=vmlist; m && cursize; m=m->next) {
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 5a903491e697..8497609f5022 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -358,11 +358,10 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
358 const char *errmsg; 358 const char *errmsg;
359 struct qnx4_sb_info *qs; 359 struct qnx4_sb_info *qs;
360 360
361 qs = kmalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL); 361 qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
362 if (!qs) 362 if (!qs)
363 return -ENOMEM; 363 return -ENOMEM;
364 s->s_fs_info = qs; 364 s->s_fs_info = qs;
365 memset(qs, 0, sizeof(struct qnx4_sb_info));
366 365
367 sb_set_blocksize(s, QNX4_BLOCK_SIZE); 366 sb_set_blocksize(s, QNX4_BLOCK_SIZE);
368 367
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 876639b93321..350cba5d6803 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -369,10 +369,9 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
369 if (64 != sizeof (struct sysv_inode)) 369 if (64 != sizeof (struct sysv_inode))
370 panic("sysv fs: bad inode size"); 370 panic("sysv fs: bad inode size");
371 371
372 sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); 372 sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
373 if (!sbi) 373 if (!sbi)
374 return -ENOMEM; 374 return -ENOMEM;
375 memset(sbi, 0, sizeof(struct sysv_sb_info));
376 375
377 sbi->s_sb = sb; 376 sbi->s_sb = sb;
378 sbi->s_block_base = 0; 377 sbi->s_block_base = 0;
@@ -453,10 +452,9 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
453 if (64 != sizeof (struct sysv_inode)) 452 if (64 != sizeof (struct sysv_inode))
454 panic("sysv fs: bad i-node size"); 453 panic("sysv fs: bad i-node size");
455 454
456 sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); 455 sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
457 if (!sbi) 456 if (!sbi)
458 return -ENOMEM; 457 return -ENOMEM;
459 memset(sbi, 0, sizeof(struct sysv_sb_info));
460 458
461 sbi->s_sb = sb; 459 sbi->s_sb = sb;
462 sbi->s_block_base = 0; 460 sbi->s_block_base = 0;
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 33323473e3c4..d1d38238ce65 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -130,14 +130,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
130 { 130 {
131 UDF_I_EFE(inode) = 1; 131 UDF_I_EFE(inode) = 1;
132 UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); 132 UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE);
133 UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); 133 UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
134 memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry));
135 } 134 }
136 else 135 else
137 { 136 {
138 UDF_I_EFE(inode) = 0; 137 UDF_I_EFE(inode) = 0;
139 UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); 138 UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);
140 memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct fileEntry));
141 } 139 }
142 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) 140 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
143 UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; 141 UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 992ee0b87cc3..ef910e784034 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -611,11 +611,10 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
611 611
612 UFSD("ENTER\n"); 612 UFSD("ENTER\n");
613 613
614 sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL); 614 sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
615 if (!sbi) 615 if (!sbi)
616 goto failed_nomem; 616 goto failed_nomem;
617 sb->s_fs_info = sbi; 617 sb->s_fs_info = sbi;
618 memset(sbi, 0, sizeof(struct ufs_sb_info));
619 618
620 UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); 619 UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));
621 620