mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
btrfs: zoned: use vcalloc instead of for vzalloc in btrfs_get_dev_zone_info
Use vcalloc that checks potential multiplication overflows. The changes were done using Coccinelle semantic patch. Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
706a741595
commit
07a3bb95ea
1 changed files with 2 additions and 2 deletions
|
@ -465,8 +465,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
|
|||
* use the cache.
|
||||
*/
|
||||
if (populate_cache && bdev_is_zoned(device->bdev)) {
|
||||
zone_info->zone_cache = vzalloc(sizeof(struct blk_zone) *
|
||||
zone_info->nr_zones);
|
||||
zone_info->zone_cache = vcalloc(zone_info->nr_zones,
|
||||
sizeof(struct blk_zone));
|
||||
if (!zone_info->zone_cache) {
|
||||
btrfs_err_in_rcu(device->fs_info,
|
||||
"zoned: failed to allocate zone cache for %s",
|
||||
|
|
Loading…
Reference in a new issue