]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: convert kmalloc_array to kmalloc_objs in btrfs_calc_avail_data_space()
authorDavid Sterba <dsterba@suse.com>
Tue, 14 Apr 2026 15:30:34 +0000 (17:30 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 8 Jun 2026 13:53:28 +0000 (15:53 +0200)
There's one use of kmalloc_array() that can be transformed to
kmalloc_objs() in the same way as suggested in commit 69050f8d6d075d
("treewide: Replace kmalloc with kmalloc_obj for non-scalar types"),
swap the arguments and drop GFP flags. All the other cases of
kmalloc_array() do not use a simple type so this is the only one.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/super.c

index b26aa9169e83884984e11d23b0ec55cbf8769977..f67a268f36a6d6a2535d03177897545adb0d9765 100644 (file)
@@ -1633,8 +1633,7 @@ static inline int btrfs_calc_avail_data_space(struct btrfs_fs_info *fs_info,
                }
        }
 
-       devices_info = kmalloc_array(nr_devices, sizeof(*devices_info),
-                              GFP_KERNEL);
+       devices_info = kmalloc_objs(*devices_info, nr_devices);
        if (!devices_info)
                return -ENOMEM;