2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:15 -08:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:50 +00:00
|
|
|
|
2024-09-10 17:14:49 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:15 -08:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-31 18:13:35 -07:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
2025-11-26 13:36:46 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:49 +00:00
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:13 -08:00
|
|
|
|
2024-09-10 17:14:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:05 -07:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 14:28:45 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:04 -07:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-02 18:34:04 -07:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2025-08-27 17:39:59 +03:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2025-05-23 23:05:17 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-27 17:39:57 +03:00
|
|
|
|
|
|
|
|
|
2025-08-27 17:39:59 +03:00
|
|
|
|
2025-08-27 17:39:57 +03:00
|
|
|
|
|
|
|
|
|
2025-08-27 17:39:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
2025-05-14 15:40:28 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
2025-07-31 18:13:35 -07:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
2025-08-27 17:39:57 +03:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
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-20 23:49:23 -08:00
|
|
|
|
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses
Conversion performed via this Coccinelle script:
// SPDX-License-Identifier: GPL-2.0-only
// Options: --include-headers-for-types --all-includes --include-headers --keep-comments
virtual patch
@gfp depends on patch && !(file in "tools") && !(file in "samples")@
identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
kzalloc_obj,kzalloc_objs,kzalloc_flex,
kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
@@
ALLOC(...
- , GFP_KERNEL
)
$ make coccicheck MODE=patch COCCI=gfp.cocci
Build and boot tested x86_64 with Fedora 42's GCC and Clang:
Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21 23:46:04 -08:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-20 23:49:23 -08:00
|
|
|
|
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses
Conversion performed via this Coccinelle script:
// SPDX-License-Identifier: GPL-2.0-only
// Options: --include-headers-for-types --all-includes --include-headers --keep-comments
virtual patch
@gfp depends on patch && !(file in "tools") && !(file in "samples")@
identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex,
kzalloc_obj,kzalloc_objs,kzalloc_flex,
kvmalloc_obj,kvmalloc_objs,kvmalloc_flex,
kvzalloc_obj,kvzalloc_objs,kvzalloc_flex};
@@
ALLOC(...
- , GFP_KERNEL
)
$ make coccicheck MODE=patch COCCI=gfp.cocci
Build and boot tested x86_64 with Fedora 42's GCC and Clang:
Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21 23:46:04 -08:00
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:21 +00:00
|
|
|
|
2025-02-04 13:56:14 -08:00
|
|
|
|
2024-09-10 17:14:49 +00:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-23 23:05:17 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2025-07-31 18:13:35 -07:00
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
2026-01-07 17:29:38 -08:00
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
2026-03-02 16:32:56 -08:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
2025-10-29 06:54:19 +00:00
|
|
|
|
|
|
|
|
|
2025-05-08 00:48:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-10 17:14:50 +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