* [PATCH] coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg
@ 2026-03-20 17:51 Kees Cook
2026-03-27 11:50 ` [cocci] " Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Kees Cook @ 2026-03-20 17:51 UTC (permalink / raw)
To: Julia Lawall
Cc: Kees Cook, Nicolas Palix, cocci, linux-kernel, linux-hardening
Remove any GFP_KERNEL arguments found in the new kmalloc_obj-family
helpers. This captures the script used in commit 189f164e573e ("Convert
remaining multi-line kmalloc_obj/flex GFP_KERNEL uses").
Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: Julia Lawall <Julia.Lawall@inria.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: <cocci@inria.fr>
---
scripts/coccinelle/api/kmalloc_objs.cocci | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/coccinelle/api/kmalloc_objs.cocci b/scripts/coccinelle/api/kmalloc_objs.cocci
index db12b7be7247..e9a415b7b6f4 100644
--- a/scripts/coccinelle/api/kmalloc_objs.cocci
+++ b/scripts/coccinelle/api/kmalloc_objs.cocci
@@ -122,3 +122,14 @@ fresh identifier ALLOC_OBJS = script:python(ALLOC_ARRAY) { alloc_array(ALLOC_ARR
- ALLOC(struct_size_t(TYPE, FLEX, COUNT), GFP)
+ ALLOC_FLEX(TYPE, FLEX, COUNT, GFP)
)
+
+@drop_gfp_kernel 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
+ )
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [cocci] [PATCH] coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg
2026-03-20 17:51 [PATCH] coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg Kees Cook
@ 2026-03-27 11:50 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-03-27 11:50 UTC (permalink / raw)
To: Kees Cook, cocci, Julia Lawall, Nicolas Palix; +Cc: LKML, linux-hardening
…
> +++ b/scripts/coccinelle/api/kmalloc_objs.cocci
> @@ -122,3 +122,14 @@ fresh identifier ALLOC_OBJS = script:python(ALLOC_ARRAY) { alloc_array(ALLOC_ARR
> - ALLOC(struct_size_t(TYPE, FLEX, COUNT), GFP)
> + ALLOC_FLEX(TYPE, FLEX, COUNT, GFP)
> )
> +
> +@drop_gfp_kernel 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
> + )
Would it become helpful to clarify the software run time characteristics any further
for the selection of mentioned identifiers?
* SmPL disjunction
* Regular expression
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-27 11:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 17:51 [PATCH] coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg Kees Cook
2026-03-27 11:50 ` [cocci] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox