Re: [cocci] [PATCH] cocci: drm: report devm-allocated arguments and fields
From: Markus Elfring
Date: Sat Sep 27 2025 - 05:34:05 EST
…> +// find devm-allocated (devres-managed) second arg for drm*init functions
> +@badarg exists@
> +position p;
> +expression devm,e;
> +@@
> +// only devm_kzalloc is really used
> +devm = \(devm_kzalloc\|devm_kcalloc\|devm_kmalloc\|devm_kmalloc_array\)(...);
> +...
…> +// same as above, but with an intermediate local variable
> +@badarg2 exists@
> +position p;
> +expression devm,e;
> +identifier vitm;
> +@@
> +// only devm_kzalloc is really used
> +devm = \(devm_kzalloc\|devm_kcalloc\|devm_kmalloc\|devm_kmalloc_array\)(...);
> +...
> +vitm = <+...devm...+>;
…
Your source code search approach affects recurring development concerns.
The shown rules start with the same SmPL code.
Thus I would find it nicer if such duplicate code can be avoided.
I imagine that software run time characteristics would be more desirable
if selected data processing does not need to be repeated.
The search should obviously be continued after a relevant source code place was found.
…> +@script:python depends on report@
> +p << badarg.p;
…> +@script:python depends on report@
> +p << badarg2.p;
…> +@script:python depends on report@
> +p << badfield.p;
…
Will development interests grow for another clarification approach?
Support for SmPL rule groups
2019-04-07
https://github.com/coccinelle/coccinelle/issues/164
Regards,
Markus