]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
authorKees Cook <kees@kernel.org>
Sun, 22 Feb 2026 22:41:11 +0000 (14:41 -0800)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Apr 2026 19:39:56 +0000 (21:39 +0200)
commit7c7f99c57a13c49b13ff9fbdd922e4a6aa48bfc1
tree02119e20c906dc372bc65cf49520285c7cfdcd6f
parenta4bb45b0e5aed51c98238133ed4944973e0b9a97
treewide: Replace kmalloc with kmalloc_obj for non-scalar types

Source kernel commit: 69050f8d6d075dc01af7a5f2f550a8067510366f

This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:     kmalloc(sizeof(TYPE), ...)
are replaced with:      kmalloc_obj(TYPE, ...)

Array allocations:      kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:      kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:      kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook <kees@kernel.org>
libxfs/xfs_ag.c
libxfs/xfs_defer.c
libxfs/xfs_dir2.c
libxfs/xfs_refcount.c
libxfs/xfs_rtgroup.c