btrfs: Replace kmalloc with kmalloc_array
Replace kmalloc(size * nr, ) with kmalloc_array(nr, size), thus making it easier to check is that the calculation doesn't wrap or return a smaller allocation Signed-off-by: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com> Reviewed-by: Zach Brown <zab@redhat.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
这个提交包含在:
@@ -4901,7 +4901,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
||||
num_stripes = map->num_stripes;
|
||||
max_errors = nr_parity_stripes(map);
|
||||
|
||||
raid_map = kmalloc(sizeof(u64) * num_stripes,
|
||||
raid_map = kmalloc_array(num_stripes, sizeof(u64),
|
||||
GFP_NOFS);
|
||||
if (!raid_map) {
|
||||
ret = -ENOMEM;
|
||||
|
在新工单中引用
屏蔽一个用户