diff options
-rw-r--r-- | fs/nfs/idmap.c | 4 | ||||
-rw-r--r-- | fs/nfs/inode.c | 6 | ||||
-rw-r--r-- | fs/nfs/unlink.c | 3 | ||||
-rw-r--r-- | fs/nfs/write.c | 6 |
4 files changed, 6 insertions, 13 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 32c95a0d93f3..b89d27f93d66 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -101,11 +101,9 @@ nfs_idmap_new(struct nfs4_client *clp) | |||
101 | 101 | ||
102 | if (clp->cl_idmap != NULL) | 102 | if (clp->cl_idmap != NULL) |
103 | return; | 103 | return; |
104 | if ((idmap = kmalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) | 104 | if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) |
105 | return; | 105 | return; |
106 | 106 | ||
107 | memset(idmap, 0, sizeof(*idmap)); | ||
108 | |||
109 | snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), | 107 | snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), |
110 | "%s/idmap", clp->cl_rpcclient->cl_pathname); | 108 | "%s/idmap", clp->cl_rpcclient->cl_pathname); |
111 | 109 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b81149eb26e5..521d1dcb4cf0 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1638,10 +1638,9 @@ static struct super_block *nfs_get_sb(struct file_system_type *fs_type, | |||
1638 | #endif /* CONFIG_NFS_V3 */ | 1638 | #endif /* CONFIG_NFS_V3 */ |
1639 | 1639 | ||
1640 | s = ERR_PTR(-ENOMEM); | 1640 | s = ERR_PTR(-ENOMEM); |
1641 | server = kmalloc(sizeof(struct nfs_server), GFP_KERNEL); | 1641 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); |
1642 | if (!server) | 1642 | if (!server) |
1643 | goto out_err; | 1643 | goto out_err; |
1644 | memset(server, 0, sizeof(struct nfs_server)); | ||
1645 | /* Zero out the NFS state stuff */ | 1644 | /* Zero out the NFS state stuff */ |
1646 | init_nfsv4_state(server); | 1645 | init_nfsv4_state(server); |
1647 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); | 1646 | 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 | return ERR_PTR(-EINVAL); | 1941 | return ERR_PTR(-EINVAL); |
1943 | } | 1942 | } |
1944 | 1943 | ||
1945 | server = kmalloc(sizeof(struct nfs_server), GFP_KERNEL); | 1944 | server = kzalloc(sizeof(struct nfs_server), GFP_KERNEL); |
1946 | if (!server) | 1945 | if (!server) |
1947 | return ERR_PTR(-ENOMEM); | 1946 | return ERR_PTR(-ENOMEM); |
1948 | memset(server, 0, sizeof(struct nfs_server)); | ||
1949 | /* Zero out the NFS state stuff */ | 1947 | /* Zero out the NFS state stuff */ |
1950 | init_nfsv4_state(server); | 1948 | init_nfsv4_state(server); |
1951 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); | 1949 | server->client = server->client_sys = server->client_acl = ERR_PTR(-EINVAL); |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index a65c7b53d558..0e28189c2151 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -163,10 +163,9 @@ nfs_async_unlink(struct dentry *dentry) | |||
163 | struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode); | 163 | struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode); |
164 | int status = -ENOMEM; | 164 | int status = -ENOMEM; |
165 | 165 | ||
166 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 166 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
167 | if (!data) | 167 | if (!data) |
168 | goto out; | 168 | goto out; |
169 | memset(data, 0, sizeof(*data)); | ||
170 | 169 | ||
171 | data->cred = rpcauth_lookupcred(clnt->cl_auth, 0); | 170 | data->cred = rpcauth_lookupcred(clnt->cl_auth, 0); |
172 | if (IS_ERR(data->cred)) { | 171 | if (IS_ERR(data->cred)) { |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index d6ad449041eb..92ecf24455c3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -100,10 +100,8 @@ static inline struct nfs_write_data *nfs_commit_alloc(unsigned int pagecount) | |||
100 | p->pagevec = &p->page_array[0]; | 100 | p->pagevec = &p->page_array[0]; |
101 | else { | 101 | else { |
102 | size_t size = ++pagecount * sizeof(struct page *); | 102 | size_t size = ++pagecount * sizeof(struct page *); |
103 | p->pagevec = kmalloc(size, GFP_NOFS); | 103 | p->pagevec = kzalloc(size, GFP_NOFS); |
104 | if (p->pagevec) { | 104 | if (!p->pagevec) { |
105 | memset(p->pagevec, 0, size); | ||
106 | } else { | ||
107 | mempool_free(p, nfs_commit_mempool); | 105 | mempool_free(p, nfs_commit_mempool); |
108 | p = NULL; | 106 | p = NULL; |
109 | } | 107 | } |