diff options
author | Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com> | 2013-10-31 01:02:18 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-11-11 22:12:22 -0500 |
commit | d9b0d9ba04cf99abff9125b688c03e154598a644 (patch) | |
tree | 19d5fd9776a761379a89a1f87e452973bd9685a1 /fs/btrfs/super.c | |
parent | e248e04e7798d234ddbeab6ee6acdec2476fe1a8 (diff) |
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>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index c9079db7441e..1de6d4d67431 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1470,7 +1470,7 @@ static int btrfs_calc_avail_data_space(struct btrfs_root *root, u64 *free_bytes) | |||
1470 | nr_devices = fs_info->fs_devices->open_devices; | 1470 | nr_devices = fs_info->fs_devices->open_devices; |
1471 | BUG_ON(!nr_devices); | 1471 | BUG_ON(!nr_devices); |
1472 | 1472 | ||
1473 | devices_info = kmalloc(sizeof(*devices_info) * nr_devices, | 1473 | devices_info = kmalloc_array(nr_devices, sizeof(*devices_info), |
1474 | GFP_NOFS); | 1474 | GFP_NOFS); |
1475 | if (!devices_info) | 1475 | if (!devices_info) |
1476 | return -ENOMEM; | 1476 | return -ENOMEM; |