linux/init
Kees Cook 69050f8d6d treewide: Replace kmalloc with kmalloc_obj for non-scalar types
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>
2026-02-21 01:02:28 -08:00
..
.gitignore kbuild: build init/built-in.a just once 2022-09-29 04:40:15 +09:00
.kunitconfig initramfs_test: kunit tests for initramfs unpacking 2025-03-08 12:13:04 +01:00
calibrate.c calibrate: update header inclusion 2025-11-27 14:24:45 -08:00
do_mounts.c vfs-7.0-rc1.nullfs 2026-02-09 13:41:34 -08:00
do_mounts.h fs: use nullfs unconditionally as the real rootfs 2026-01-14 11:23:39 +01:00
do_mounts_initrd.c init: remove /proc/sys/kernel/real-root-dev 2026-01-12 17:22:27 +01:00
do_mounts_rd.c initrd: remove deprecated code path (linuxrc) 2026-01-12 17:22:22 +01:00
init_task.c Scheduler changes for v7.0: 2026-02-10 12:50:10 -08:00
initramfs.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
initramfs_internal.h init: add initramfs_internal.h 2025-03-04 09:52:36 +01:00
initramfs_test.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
Kconfig compiler_types: Disable __builtin_counted_by_ref for Clang 2026-02-21 01:01:14 -08:00
main.c mm.git review status for linus..mm-nonmm-stable 2026-02-12 12:13:01 -08:00
Makefile initramfs_test: kunit tests for initramfs unpacking 2025-03-08 12:13:04 +01:00
noinitramfs.c init: move usermodehelper_enable() to populate_rootfs() 2021-09-08 11:50:27 -07:00
version-timestamp.c ns: drop custom reference count initialization for initial namespaces 2025-11-11 10:01:32 +01:00
version.c init/version.c: Replace strlcpy with strscpy 2023-09-22 09:50:56 -07:00