linux/kernel/module
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
..
debug_kmemleak.c module: prepare to handle ROX allocations for text 2024-11-07 14:25:15 -08:00
decompress.c module/decompress: Avoid open-coded kvrealloc() 2025-12-22 16:35:54 +00:00
dups.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
internal.h module: move 'struct module_use' to internal.h 2025-07-31 13:40:46 +02:00
kallsyms.c module: add helper function for reading module_buildid() 2026-01-20 19:44:22 -08:00
Kconfig module: Remove SHA-1 support for module signing 2025-12-22 16:35:53 +00:00
kdb.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
kmod.c kernel: modules: Add SPDX license identifier to kmod.c 2026-01-15 16:58:28 -08:00
livepatch.c livepatch: fix ELF typos 2023-03-09 11:08:24 +01:00
main.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
Makefile module: Fix KCOV-ignored file name 2024-08-08 17:36:35 +02:00
procfs.c module: replace module_layout with module_memory 2023-03-09 12:55:15 -08:00
signing.c module: Fix prefix for module.sig_enforce module param 2022-06-02 12:44:33 -07:00
stats.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
strict_rwx.c module: Make .static_call_sites read-only after init 2025-05-18 13:56:22 +02:00
sysfs.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tracking.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tree_lookup.c kcfi: Rename CONFIG_CFI_CLANG to CONFIG_CFI 2025-09-24 14:29:14 -07:00
version.c module: Use RCU in find_symbol(). 2025-03-10 11:54:44 +01:00