提交 5d4958f9 编写于 作者: A Avantika Mathur 提交者: Linus Torvalds

[PATCH] ext4: kmalloc to kzalloc

Performs kmalloc to kzalloc conversion
Signed-off-by: NAvantika Mathur <mathur@us.ibm.com>
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7e028976
...@@ -477,13 +477,12 @@ ext4_ext_find_extent(struct inode *inode, int block, struct ext4_ext_path *path) ...@@ -477,13 +477,12 @@ ext4_ext_find_extent(struct inode *inode, int block, struct ext4_ext_path *path)
/* account possible depth increase */ /* account possible depth increase */
if (!path) { if (!path) {
path = kmalloc(sizeof(struct ext4_ext_path) * (depth + 2), path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 2),
GFP_NOFS); GFP_NOFS);
if (!path) if (!path)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
alloc = 1; alloc = 1;
} }
memset(path, 0, sizeof(struct ext4_ext_path) * (depth + 1));
path[0].p_hdr = eh; path[0].p_hdr = eh;
/* walk through the tree */ /* walk through the tree */
...@@ -643,10 +642,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, ...@@ -643,10 +642,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
* We need this to handle errors and free blocks * We need this to handle errors and free blocks
* upon them. * upon them.
*/ */
ablocks = kmalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS); ablocks = kzalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS);
if (!ablocks) if (!ablocks)
return -ENOMEM; return -ENOMEM;
memset(ablocks, 0, sizeof(ext4_fsblk_t) * depth);
/* allocate all needed blocks */ /* allocate all needed blocks */
ext_debug("allocate %d blocks for indexes/leaf\n", depth - at); ext_debug("allocate %d blocks for indexes/leaf\n", depth - at);
...@@ -1773,12 +1771,11 @@ int ext4_ext_remove_space(struct inode *inode, unsigned long start) ...@@ -1773,12 +1771,11 @@ int ext4_ext_remove_space(struct inode *inode, unsigned long start)
* We start scanning from right side, freeing all the blocks * We start scanning from right side, freeing all the blocks
* after i_size and walking into the tree depth-wise. * 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) { if (path == NULL) {
ext4_journal_stop(handle); ext4_journal_stop(handle);
return -ENOMEM; return -ENOMEM;
} }
memset(path, 0, sizeof(struct ext4_ext_path) * (depth + 1));
path[0].p_hdr = ext_inode_hdr(inode); path[0].p_hdr = ext_inode_hdr(inode);
if (ext4_ext_check_header(__FUNCTION__, inode, path[0].p_hdr)) { if (ext4_ext_check_header(__FUNCTION__, inode, path[0].p_hdr)) {
err = -EIO; err = -EIO;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册