btrfs: cleanup, use kmalloc_array/kcalloc array helpers

Convert kmalloc(nr * size, ..) to kmalloc_array that does additional
overflow checks, the zeroing variant is kcalloc.

Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
David Sterba
2015-02-20 18:00:26 +01:00
parent f8c269d722
commit 31e818fe73
11 changed files with 18 additions and 21 deletions

View File

@@ -964,9 +964,8 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check)
* the statistics.
*/
sblocks_for_recheck = kzalloc(BTRFS_MAX_MIRRORS *
sizeof(*sblocks_for_recheck),
GFP_NOFS);
sblocks_for_recheck = kcalloc(BTRFS_MAX_MIRRORS,
sizeof(*sblocks_for_recheck), GFP_NOFS);
if (!sblocks_for_recheck) {
spin_lock(&sctx->stat_lock);
sctx->stat.malloc_errors++;