]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: replace kcalloc() calls to kzalloc_objs()
authorMiquel Sabaté Solà <mssola@mssola.com>
Tue, 24 Feb 2026 21:45:44 +0000 (22:45 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:59 +0000 (18:55 +0200)
commit2d2b5507e598984f5832f0c5193f35733c42995e
treec322c7f39254bd87a8a220cf5db89b74191ad893
parent6603a9859887ed325fea9fc9347c2d9e6cf3bbe3
btrfs: replace kcalloc() calls to kzalloc_objs()

Commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj() and family")
introduced, among many others, the kzalloc_objs() helper, which has some
benefits over kcalloc(). Namely, internal introspection of the allocated
type now becomes possible, allowing for future alignment-aware choices
to be made by the allocator and future hardening work that can be type
sensitive. Dropping 'sizeof' comes also as a nice side-effect.

Moreover, this also allows us to be in line with the recent tree-wide
migration to the kmalloc_obj() and family of helpers. See
commit 69050f8d6d07 ("treewide: Replace kmalloc with kmalloc_obj for
non-scalar types").

Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/raid56.c
fs/btrfs/tests/zoned-tests.c
fs/btrfs/volumes.c
fs/btrfs/zoned.c