Commit bd647545 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Trond Myklebust

NFS: kzalloc conversion in fs/nfs

this converts fs/nfs to kzalloc() usage.
compile tested with make allyesconfig
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent a162a6b8
...@@ -101,11 +101,9 @@ nfs_idmap_new(struct nfs4_client *clp) ...@@ -101,11 +101,9 @@ nfs_idmap_new(struct nfs4_client *clp)
if (clp->cl_idmap != NULL) if (clp->cl_idmap != NULL)
return; return;
if ((idmap = kmalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL)
return; return;
memset(idmap, 0, sizeof(*idmap));
snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), snprintf(idmap->idmap_path, sizeof(idmap->idmap_path),
"%s/idmap", clp->cl_rpcclient->cl_pathname); "%s/idmap", clp->cl_rpcclient->cl_pathname);
......
...@@ -1638,10 +1638,9 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, ...@@ -1638,10 +1638,9 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type,
#endif /* CONFIG_NFS_V3 */ #endif /* CONFIG_NFS_V3 */
s = ERR_PTR(-ENOMEM); s = ERR_PTR(-ENOMEM);
server = kmalloc(sizeof(struct nfs_server), GFP_KERNEL); server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL);
if (!server) if (!server)
goto out_err; goto out_err;
memset(server, 0, sizeof(struct nfs_server));
/* Zero out the NFS state stuff */ /* Zero out the NFS state stuff */
init_nfsv4_state(server); init_nfsv4_state(server);
server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL);
...@@ -1942,10 +1941,9 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type, ...@@ -1942,10 +1941,9 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
server = kmalloc(sizeof(struct nfs_server), GFP_KERNEL); server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL);
if (!server) if (!server)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
memset(server, 0, sizeof(struct nfs_server));
/* Zero out the NFS state stuff */ /* Zero out the NFS state stuff */
init_nfsv4_state(server); init_nfsv4_state(server);
server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL);
......
...@@ -163,10 +163,9 @@ nfs_async_unlink(struct dentry *dentry) ...@@ -163,10 +163,9 @@ nfs_async_unlink(struct dentry *dentry)
struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode); struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode);
int status = -ENOMEM; int status = -ENOMEM;
data = kmalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
goto out; goto out;
memset(data, 0, sizeof(*data));
data->cred = rpcauth_lookupcred(clnt->cl_auth, 0); data->cred = rpcauth_lookupcred(clnt->cl_auth, 0);
if (IS_ERR(data->cred)) { if (IS_ERR(data->cred)) {
......
...@@ -100,10 +100,8 @@ static inline struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount) ...@@ -100,10 +100,8 @@ static inline struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount)
p->pagevec = &p->page_array[0]; p->pagevec = &p->page_array[0];
else { else {
size_t size = ++pagecount * sizeof(struct page *); size_t size = ++pagecount * sizeof(struct page *);
p->pagevec = kmalloc(size, GFP_NOFS); p->pagevec = kzalloc(size, GFP_NOFS);
if (p->pagevec) { if (!p->pagevec) {
memset(p->pagevec, 0, size);
} else {
mempool_free(p, nfs_commit_mempool); mempool_free(p, nfs_commit_mempool);
p = NULL; p = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment