Re: [cocci] [PATCH] coccinelle: kmalloc_obj: Remove default GFP_KERNEL arg

Markus Elfring <[email protected]> Fri, 27 Mar 2026 12:50:42 +0100
Newsgroups fr.inria.cocci,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
…
> +++ 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