[PATCH] fs: Conversions from kmalloc+memset to k(z|c)alloc
authorPanagiotis Issaris <takis@issaris.org>
Wed, 27 Sep 2006 08:49:37 +0000 (01:49 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 27 Sep 2006 15:26:10 +0000 (08:26 -0700)
Conversions from kmalloc+memset to kzalloc.

Signed-off-by: Panagiotis Issaris <takis@issaris.org>
Jffs2-bit-acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
35 files changed:
fs/adfs/super.c
fs/affs/super.c
fs/afs/vlocation.c
fs/afs/volume.c
fs/autofs/inode.c
fs/bfs/inode.c
fs/configfs/file.c
fs/configfs/inode.c
fs/cramfs/inode.c
fs/efs/super.c
fs/ext2/super.c
fs/ext2/xattr.c
fs/ext3/dir.c
fs/ext3/super.c
fs/fat/inode.c
fs/hfs/bnode.c
fs/hfs/btree.c
fs/hfs/super.c
fs/hfsplus/bnode.c
fs/hfsplus/btree.c
fs/hpfs/super.c
fs/isofs/inode.c
fs/jffs2/super.c
fs/lockd/host.c
fs/lockd/svcsubs.c
fs/minix/inode.c
fs/ncpfs/inode.c
fs/nfsd/nfs4idmap.c
fs/nfsd/nfs4state.c
fs/partitions/efi.c
fs/proc/kcore.c
fs/qnx4/inode.c
fs/sysv/super.c
fs/udf/ialloc.c
fs/ufs/super.c

index 82011019494ccf6bbcefa838e28b5c130739470b..959dbf1f8e63eb10ba94dbf580a494930a727756 100644 (file)
@@ -339,11 +339,10 @@ static int adfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_flags |= MS_NODIRATIME;
 
-       asb = kmalloc(sizeof(*asb), GFP_KERNEL);
+       asb = kzalloc(sizeof(*asb), GFP_KERNEL);
        if (!asb)
                return -ENOMEM;
        sb->s_fs_info = asb;
-       memset(asb, 0, sizeof(*asb));
 
        /* set default options */
        asb->s_uid = 0;
index 17352011ab6700120d22501cc0ebce6992ba79dc..b35f514479bfeedd850ec5ee992483a02b315268 100644 (file)
@@ -280,11 +280,10 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op                = &affs_sops;
        sb->s_flags |= MS_NODIRATIME;
 
-       sbi = kmalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct affs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*sbi));
        init_MUTEX(&sbi->s_bmlock);
 
        if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
index 331f730a1fb34435223c000ea590ecd078a0784d..782ee7c600caf0ec80c43f9c91407d1d93d6d506 100644 (file)
@@ -281,11 +281,10 @@ int afs_vlocation_lookup(struct afs_cell *cell,
        spin_unlock(&cell->vl_gylock);
 
        /* not in the cell's in-memory lists - create a new record */
-       vlocation = kmalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
+       vlocation = kzalloc(sizeof(struct afs_vlocation), GFP_KERNEL);
        if (!vlocation)
                return -ENOMEM;
 
-       memset(vlocation, 0, sizeof(struct afs_vlocation));
        atomic_set(&vlocation->usage, 1);
        INIT_LIST_HEAD(&vlocation->link);
        rwlock_init(&vlocation->lock);
index 0ff4b86476e39288313fe3f92bd7ed1aaaedd3d3..768c6dbd323ac625277d478086a98f4585a6ae88 100644 (file)
@@ -186,11 +186,10 @@ int afs_volume_lookup(const char *name, struct afs_cell *cell, int rwpath,
        _debug("creating new volume record");
 
        ret = -ENOMEM;
-       volume = kmalloc(sizeof(struct afs_volume), GFP_KERNEL);
+       volume = kzalloc(sizeof(struct afs_volume), GFP_KERNEL);
        if (!volume)
                goto error_up;
 
-       memset(volume, 0, sizeof(struct afs_volume));
        atomic_set(&volume->usage, 1);
        volume->type            = type;
        volume->type_force      = force;
index af2efbbb5d76ef7a6db921ba43316b5570c4dadf..c81d6b8c282868e4bd43baa1adf2099d88206704 100644 (file)
@@ -129,10 +129,9 @@ int autofs_fill_super(struct super_block *s, void *data, int silent)
        struct autofs_sb_info *sbi;
        int minproto, maxproto;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if ( !sbi )
                goto fail_unlock;
-       memset(sbi, 0, sizeof(*sbi));
        DPRINTK(("autofs: starting up, sbi = %p\n",sbi));
 
        s->s_fs_info = sbi;
index cf74f3d4d966d0f81c8abace34a1bfe79d9050e8..3e4d6c767b9b381e00e5dceab61a5b4ed9e5e3b5 100644 (file)
@@ -311,11 +311,10 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
        unsigned i, imap_len;
        struct bfs_sb_info * info;
 
-       info = kmalloc(sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info)
                return -ENOMEM;
        s->s_fs_info = info;
-       memset(info, 0, sizeof(*info));
 
        sb_set_blocksize(s, BFS_BSIZE);
 
@@ -338,10 +337,9 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
                        + BFS_ROOT_INO - 1;
 
        imap_len = info->si_lasti/8 + 1;
-       info->si_imap = kmalloc(imap_len, GFP_KERNEL);
+       info->si_imap = kzalloc(imap_len, GFP_KERNEL);
        if (!info->si_imap)
                goto out;
-       memset(info->si_imap, 0, imap_len);
        for (i=0; i<BFS_ROOT_INO; i++) 
                set_bit(i, info->si_imap);
 
index f499803743e04add3d576dc919e0a54752d00ba1..85105e50f7db668702b36ea78a32feaa6ef12593 100644 (file)
@@ -274,9 +274,8 @@ static int check_perm(struct inode * inode, struct file * file)
        /* No error? Great, allocate a buffer for the file, and store it
         * it in file->private_data for easy access.
         */
-       buffer = kmalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
+       buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
        if (buffer) {
-               memset(buffer,0,sizeof(struct configfs_buffer));
                init_MUTEX(&buffer->sem);
                buffer->needs_read_fill = 1;
                buffer->ops = ops;
index e14488ca6411fef8db1fb86e1252f49b99f9b2a7..5047e6a7581e2b042bba57d547fe3417b3a9f5fa 100644 (file)
@@ -76,11 +76,10 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
 
        if (!sd_iattr) {
                /* setting attributes for the first time, allocate now */
-               sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL);
+               sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);
                if (!sd_iattr)
                        return -ENOMEM;
                /* assign default attributes */
-               memset(sd_iattr, 0, sizeof(struct iattr));
                sd_iattr->ia_mode = sd->s_mode;
                sd_iattr->ia_uid = 0;
                sd_iattr->ia_gid = 0;
index 223c0431042deaa8fb77aa99626100338e546f4e..d09b6777c41a20172bdc8a8ee8946ae25f95bfd8 100644 (file)
@@ -242,11 +242,10 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
 
        sb->s_flags |= MS_RDONLY;
 
-       sbi = kmalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct cramfs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct cramfs_sb_info));
 
        /* Invalidate the read buffers on mount: think disk change.. */
        mutex_lock(&read_mutex);
index 8ac2462ae5dd28b45b7e5e27e5216df85be43e9f..7089269ee9ae66f5ad48caccda97b6cb39d92251 100644 (file)
@@ -248,11 +248,10 @@ static int efs_fill_super(struct super_block *s, void *d, int silent)
        struct buffer_head *bh;
        struct inode *root;
 
-       sb = kmalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
+       sb = kzalloc(sizeof(struct efs_sb_info), GFP_KERNEL);
        if (!sb)
                return -ENOMEM;
        s->s_fs_info = sb;
-       memset(sb, 0, sizeof(struct efs_sb_info));
  
        s->s_magic              = EFS_SUPER_MAGIC;
        if (!sb_set_blocksize(s, EFS_BLOCKSIZE)) {
index d978d3febb8c77aa991c2b5cae01fafc4a565308..69435fbe53f279d11b8de901cc6cbece8ef4d434 100644 (file)
@@ -655,11 +655,10 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
        int i, j;
        __le32 features;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*sbi));
 
        /*
         * See what the current blocksize for the device is, and
index 86ae8e93adb9d84dadbace346c65f0c5b09952fa..af52a7f8b291d0baf3542246fb90703032cfbecc 100644 (file)
@@ -521,11 +521,10 @@ bad_block:                ext2_error(sb, "ext2_xattr_set",
                }
        } else {
                /* Allocate a buffer where we construct the new block. */
-               header = kmalloc(sb->s_blocksize, GFP_KERNEL);
+               header = kzalloc(sb->s_blocksize, GFP_KERNEL);
                error = -ENOMEM;
                if (header == NULL)
                        goto cleanup;
-               memset(header, 0, sb->s_blocksize);
                end = (char *)header + sb->s_blocksize;
                header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC);
                header->h_blocks = header->h_refcount = cpu_to_le32(1);
index 4d97f437cd480ebe0eca72b153fbcac27c8b303c..429acbb4e064bd21352f8019e133a781523169fb 100644 (file)
@@ -343,10 +343,9 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
 
        /* Create and allocate the fname structure */
        len = sizeof(struct fname) + dirent->name_len + 1;
-       new_fn = kmalloc(len, GFP_KERNEL);
+       new_fn = kzalloc(len, GFP_KERNEL);
        if (!new_fn)
                return -ENOMEM;
-       memset(new_fn, 0, len);
        new_fn->hash = hash;
        new_fn->minor_hash = minor_hash;
        new_fn->inode = le32_to_cpu(dirent->inode);
index 10985017765b9c660a09370270abc5f804c3e2e0..09b4b313ca074bd93f19bebc7ac2c225e3e50862 100644 (file)
@@ -1407,11 +1407,10 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        int needs_recovery;
        __le32 features;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*sbi));
        sbi->s_mount_opt = 0;
        sbi->s_resuid = EXT3_DEF_RESUID;
        sbi->s_resgid = EXT3_DEF_RESGID;
index 31b7174176ba76798284286e8f6767419cef7e12..bc4da3a48c8c33d5057d89f5c7ac837b876fdb68 100644 (file)
@@ -1168,11 +1168,10 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
        long error;
        char buf[50];
 
-       sbi = kmalloc(sizeof(struct msdos_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct msdos_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct msdos_sb_info));
 
        sb->s_flags |= MS_NODIRATIME;
        sb->s_magic = MSDOS_SUPER_MAGIC;
index 13231dd5ce660c7ac5e16e476306289b12151c41..0d200068d0afaff014db5279d46c74dab06332bb 100644 (file)
@@ -249,10 +249,9 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
        sb = tree->inode->i_sb;
        size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
                sizeof(struct page *);
-       node = kmalloc(size, GFP_KERNEL);
+       node = kzalloc(size, GFP_KERNEL);
        if (!node)
                return NULL;
-       memset(node, 0, size);
        node->tree = tree;
        node->this = cnid;
        set_bit(HFS_BNODE_NEW, &node->flags);
index 40035799431992573e1e97f87e25e666f1061ddf..5fd0ed71f92331c3553ef9d563c0543e9fc9e9f6 100644 (file)
@@ -21,10 +21,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
        struct page *page;
        unsigned int size;
 
-       tree = kmalloc(sizeof(*tree), GFP_KERNEL);
+       tree = kzalloc(sizeof(*tree), GFP_KERNEL);
        if (!tree)
                return NULL;
-       memset(tree, 0, sizeof(*tree));
 
        init_MUTEX(&tree->tree_lock);
        spin_lock_init(&tree->hash_lock);
index 34937ee83ab1052d2510d1ead5d3ca9fdf78af63..05dffff1a3722a1dc9d19bd5a858ec0d4dcdca4a 100644 (file)
@@ -356,11 +356,10 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
        struct inode *root_inode;
        int res;
 
-       sbi = kmalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct hfs_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct hfs_sb_info));
        INIT_HLIST_HEAD(&sbi->rsrc_inodes);
 
        res = -EINVAL;
index 77bf434da6796d89a9181ae50f9af0dd60a6bcf5..29da6574ba77941b22c15b4e959cd4c84b8bbee1 100644 (file)
@@ -409,10 +409,9 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
        sb = tree->inode->i_sb;
        size = sizeof(struct hfs_bnode) + tree->pages_per_bnode *
                sizeof(struct page *);
-       node = kmalloc(size, GFP_KERNEL);
+       node = kzalloc(size, GFP_KERNEL);
        if (!node)
                return NULL;
-       memset(node, 0, size);
        node->tree = tree;
        node->this = cnid;
        set_bit(HFS_BNODE_NEW, &node->flags);
index cfc852fdd1b574b0455db793706018ecdb80aef0..a9b9e872e29a6296ecd4d327bd8f2653beeb7a3e 100644 (file)
@@ -24,10 +24,9 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
        struct page *page;
        unsigned int size;
 
-       tree = kmalloc(sizeof(*tree), GFP_KERNEL);
+       tree = kzalloc(sizeof(*tree), GFP_KERNEL);
        if (!tree)
                return NULL;
-       memset(tree, 0, sizeof(*tree));
 
        init_MUTEX(&tree->tree_lock);
        spin_lock_init(&tree->hash_lock);
index 8fe51c343786e99d22c2abb1b2e5b16b8a997364..b76d608323750c9cc9bcdbbd750ae290aa0d28c6 100644 (file)
@@ -462,11 +462,10 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
 
        int o;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        s->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*sbi));
 
        sbi->sb_bmp_dir = NULL;
        sbi->sb_cp_table = NULL;
index 14391361c8863b63e21fb87f5c2351d752ebcc10..ab15e9072151c08afc368feecdd7423dcb97d49a 100644 (file)
@@ -557,11 +557,10 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
        struct iso9660_options          opt;
        struct isofs_sb_info          * sbi;
 
-       sbi = kmalloc(sizeof(*sbi), GFP_KERNEL);
+       sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        s->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(*sbi));
 
        if (!parse_options((char *)data, &opt))
                goto out_freesbi;
index 68e3953419b4324504cbe8723a9b62e1cb48b3da..6de374513c010790ab15e40f4103781f669d93c8 100644 (file)
@@ -119,10 +119,9 @@ static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
        struct jffs2_sb_info *c;
        int ret;
 
-       c = kmalloc(sizeof(*c), GFP_KERNEL);
+       c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
                return -ENOMEM;
-       memset(c, 0, sizeof(*c));
        c->mtd = mtd;
 
        sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c);
index 703fb038c813c352430295c3537b6a7cc32debf8..a0d0b58ce7a49968aa8ed942d00fbec3e9fc9539 100644 (file)
@@ -99,9 +99,9 @@ nlm_lookup_host(int server, struct sockaddr_in *sin,
        /* Ooops, no host found, create it */
        dprintk("lockd: creating host entry\n");
 
-       if (!(host = (struct nlm_host *) kmalloc(sizeof(*host), GFP_KERNEL)))
+       host = kzalloc(sizeof(*host), GFP_KERNEL);
+       if (!host)
                goto nohost;
-       memset(host, 0, sizeof(*host));
 
        addr = sin->sin_addr.s_addr;
        sprintf(host->h_name, "%u.%u.%u.%u", NIPQUAD(addr));
index 01b4db9e5466d51f98383c221e41a8ede824421c..a92dd98f84013dbece84aa0367f7ed869f487c92 100644 (file)
@@ -100,11 +100,10 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
        nlm_debug_print_fh("creating file for", f);
 
        nfserr = nlm_lck_denied_nolocks;
-       file = (struct nlm_file *) kmalloc(sizeof(*file), GFP_KERNEL);
+       file = kzalloc(sizeof(*file), GFP_KERNEL);
        if (!file)
                goto out_unlock;
 
-       memset(file, 0, sizeof(*file));
        memcpy(&file->f_handle, f, sizeof(struct nfs_fh));
        file->f_hash = hash;
        init_MUTEX(&file->f_sema);
index 330ff9fc7cf065eb0b41871be0ee9a542a6a92e3..e24be7fc0651140447a0ae736d9451e8c0051a55 100644 (file)
@@ -145,11 +145,10 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
        struct inode *root_inode;
        struct minix_sb_info *sbi;
 
-       sbi = kmalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct minix_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
        s->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct minix_sb_info));
 
        /* N.B. These should be compile-time tests.
           Unfortunately that is impossible. */
@@ -207,10 +206,9 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
        if (sbi->s_imap_blocks == 0 || sbi->s_zmap_blocks == 0)
                goto out_illegal_sb;
        i = (sbi->s_imap_blocks + sbi->s_zmap_blocks) * sizeof(bh);
-       map = kmalloc(i, GFP_KERNEL);
+       map = kzalloc(i, GFP_KERNEL);
        if (!map)
                goto out_no_map;
-       memset(map, 0, i);
        sbi->s_imap = &map[0];
        sbi->s_zmap = &map[sbi->s_imap_blocks];
 
index 1ddf77b0b825d08282944604e582b78244852704..752f02e43ab0e4e75d2cda53070d80ab156be32a 100644 (file)
@@ -411,11 +411,10 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
 #endif
        struct ncp_entry_info finfo;
 
-       server = kmalloc(sizeof(struct ncp_server), GFP_KERNEL);
+       server = kzalloc(sizeof(struct ncp_server), GFP_KERNEL);
        if (!server)
                return -ENOMEM;
        sb->s_fs_info = server;
-       memset(server, 0, sizeof(struct ncp_server));
 
        error = -EFAULT;
        if (raw_data == NULL)
index bea6b94781145e7707c59dcaaaabf4cb98ea8a3f..b1902ebaab4158d03cbe1482426d89de80f76fd7 100644 (file)
@@ -573,10 +573,9 @@ idmap_lookup(struct svc_rqst *rqstp,
        struct idmap_defer_req *mdr;
        int ret;
 
-       mdr = kmalloc(sizeof(*mdr), GFP_KERNEL);
+       mdr = kzalloc(sizeof(*mdr), GFP_KERNEL);
        if (!mdr)
                return -ENOMEM;
-       memset(mdr, 0, sizeof(*mdr));
        atomic_set(&mdr->count, 1);
        init_waitqueue_head(&mdr->waitq);
        mdr->req.defer = idmap_defer;
index 9daa0b9feb8d027e438ef39c846daee95cf2d6cf..1a25c01ecdf16db93fbfd80b133963b295dcab9a 100644 (file)
@@ -339,8 +339,7 @@ alloc_client(struct xdr_netobj name)
 {
        struct nfs4_client *clp;
 
-       if ((clp = kmalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) {
-               memset(clp, 0, sizeof(*clp));
+       if ((clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) {
                if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) {
                        memcpy(clp->cl_name.data, name.data, name.len);
                        clp->cl_name.len = name.len;
index 63730282ad813688410809c25d22055c5cb38570..1bea610078b35c34808245cc2214947bd369d672 100644 (file)
@@ -238,10 +238,9 @@ alloc_read_gpt_entries(struct block_device *bdev, gpt_header *gpt)
                 le32_to_cpu(gpt->sizeof_partition_entry);
        if (!count)
                return NULL;
-       pte = kmalloc(count, GFP_KERNEL);
+       pte = kzalloc(count, GFP_KERNEL);
        if (!pte)
                return NULL;
-       memset(pte, 0, count);
 
        if (read_lba(bdev, le64_to_cpu(gpt->partition_entry_lba),
                      (u8 *) pte,
@@ -269,10 +268,9 @@ alloc_read_gpt_header(struct block_device *bdev, u64 lba)
        if (!bdev)
                return NULL;
 
-       gpt = kmalloc(sizeof (gpt_header), GFP_KERNEL);
+       gpt = kzalloc(sizeof (gpt_header), GFP_KERNEL);
        if (!gpt)
                return NULL;
-       memset(gpt, 0, sizeof (gpt_header));
 
        if (read_lba(bdev, lba, (u8 *) gpt,
                     sizeof (gpt_header)) < sizeof (gpt_header)) {
@@ -526,9 +524,8 @@ find_valid_gpt(struct block_device *bdev, gpt_header **gpt, gpt_entry **ptes)
        lastlba = last_lba(bdev);
         if (!force_gpt) {
                 /* This will be added to the EFI Spec. per Intel after v1.02. */
-                legacymbr = kmalloc(sizeof (*legacymbr), GFP_KERNEL);
+                legacymbr = kzalloc(sizeof (*legacymbr), GFP_KERNEL);
                 if (legacymbr) {
-                        memset(legacymbr, 0, sizeof (*legacymbr));
                         read_lba(bdev, 0, (u8 *) legacymbr,
                                  sizeof (*legacymbr));
                         good_pmbr = is_pmbr_valid(legacymbr, lastlba);
index 6a984f64edd7179893887528f07a63f90bf7b15c..3ceff385727273269018a6e4780a97a6bd234cc6 100644 (file)
@@ -279,12 +279,11 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
                tsz = elf_buflen - *fpos;
                if (buflen < tsz)
                        tsz = buflen;
-               elf_buf = kmalloc(elf_buflen, GFP_ATOMIC);
+               elf_buf = kzalloc(elf_buflen, GFP_ATOMIC);
                if (!elf_buf) {
                        read_unlock(&kclist_lock);
                        return -ENOMEM;
                }
-               memset(elf_buf, 0, elf_buflen);
                elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen);
                read_unlock(&kclist_lock);
                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)
                        unsigned long curstart = start;
                        unsigned long cursize = tsz;
 
-                       elf_buf = kmalloc(tsz, GFP_KERNEL);
+                       elf_buf = kzalloc(tsz, GFP_KERNEL);
                        if (!elf_buf)
                                return -ENOMEM;
-                       memset(elf_buf, 0, tsz);
 
                        read_lock(&vmlist_lock);
                        for (m=vmlist; m && cursize; m=m->next) {
index 5a903491e6972577ef38ee98a1d1c5fb1ddfc1e7..8497609f50221834986cce0b6799bec35fdca6f9 100644 (file)
@@ -358,11 +358,10 @@ static int qnx4_fill_super(struct super_block *s, void *data, int silent)
        const char *errmsg;
        struct qnx4_sb_info *qs;
 
-       qs = kmalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
+       qs = kzalloc(sizeof(struct qnx4_sb_info), GFP_KERNEL);
        if (!qs)
                return -ENOMEM;
        s->s_fs_info = qs;
-       memset(qs, 0, sizeof(struct qnx4_sb_info));
 
        sb_set_blocksize(s, QNX4_BLOCK_SIZE);
 
index 876639b93321b42ac37336fa6a336ca6bb946a56..350cba5d68034f8dd4bdbb2732e2d5bc0cc17f9a 100644 (file)
@@ -369,10 +369,9 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
        if (64 != sizeof (struct sysv_inode))
                panic("sysv fs: bad inode size");
 
-       sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
-       memset(sbi, 0, sizeof(struct sysv_sb_info));
 
        sbi->s_sb = sb;
        sbi->s_block_base = 0;
@@ -453,10 +452,9 @@ static int v7_fill_super(struct super_block *sb, void *data, int silent)
        if (64 != sizeof (struct sysv_inode))
                panic("sysv fs: bad i-node size");
 
-       sbi = kmalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
        if (!sbi)
                return -ENOMEM;
-       memset(sbi, 0, sizeof(struct sysv_sb_info));
 
        sbi->s_sb = sb;
        sbi->s_block_base = 0;
index 33323473e3c43edfbd53a16014f3bf313d580ac4..d1d38238ce65beb433608218c5ccef88c8c902ca 100644 (file)
@@ -130,14 +130,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
        {
                UDF_I_EFE(inode) = 1;
                UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE);
-               UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
-               memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry));
+               UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
        }
        else
        {
                UDF_I_EFE(inode) = 0;
-               UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);
-               memset(UDF_I_DATA(inode), 0x00, inode->i_sb->s_blocksize - sizeof(struct fileEntry));
+               UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);
        }
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
                UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
index 992ee0b87cc3f7835fa376c75733822d9ddfbdc6..ef910e7840341b132591cacdb1a0d6b3d62359ee 100644 (file)
@@ -611,11 +611,10 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
        
        UFSD("ENTER\n");
                
-       sbi = kmalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
+       sbi = kzalloc(sizeof(struct ufs_sb_info), GFP_KERNEL);
        if (!sbi)
                goto failed_nomem;
        sb->s_fs_info = sbi;
-       memset(sbi, 0, sizeof(struct ufs_sb_info));
 
        UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));