Re: [PATCH v6] coccinelle: api: add kvfree script
From: Julia Lawall
Date: Sun Aug 02 2020 - 03:09:12 EST
On Sun, 2 Aug 2020, Markus Elfring wrote:
> â
> > +++ b/scripts/coccinelle/api/kvfree.cocci
> â
> > +@choice@
> > +expression E, E1;
> > +position kok, vok;
> > +@@
> > +
> > +(
> â
> > +|
> > + E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
> > + kmalloc_array\|kmalloc_array_node\|kcalloc_node\)(...)@kok
> > + ... when != E = E1
> > + when any
> > + if (\(!E\|E == NULL\)) {
> â
>
> Can the SmPL code exclusion specification be incomplete here?
>
> How do you think about to check also if the memory is passed to any function
> (or macro) calls before the shown detection of a null pointer?
It seems both extremely unlikely and not relevant to the question at hand.
Passing E to another function will not change the value of E itself.
Passing &E to another function could change E, but it would be very
unusual to do that, and doesn't seem worth checking for.
julia