Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-03 Thread Julia Lawall
On Mon, 3 Aug 2020, Denis Efremov wrote: > > > On 8/2/20 11:24 PM, Julia Lawall wrote: > >> +@initialize:python@ > >> +@@ > >> +# low-level memory api > >> +filter = frozenset(['__vmalloc_area_node']) > >> + > >> +def relevant(p): > >> +return not (filter & {el.current_element for el in

Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-03 Thread Julia Lawall
On Mon, 3 Aug 2020, Denis Efremov wrote: > Is there a difference from cocci point of view between: > > ... when != !is_vmalloc_addr(E) This will only reject cases where the ! is present. Coccinelle doesn't apply isomorphisms to the C source code, so it doesn't detect that eg if (A) B else

Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-03 Thread Denis Efremov
Is there a difference from cocci point of view between: ... when != !is_vmalloc_addr(E) and ... when != is_vmalloc_addr(E) Should the latter one be used in most cases? Thanks, Denis

Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-03 Thread Denis Efremov
On 8/2/20 11:24 PM, Julia Lawall wrote: >> +@initialize:python@ >> +@@ >> +# low-level memory api >> +filter = frozenset(['__vmalloc_area_node']) >> + >> +def relevant(p): >> +return not (filter & {el.current_element for el in p}) > > Is this used? I'll remove it in v8. Or do you want me

Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-02 Thread Julia Lawall
> +@initialize:python@ > +@@ > +# low-level memory api > +filter = frozenset(['__vmalloc_area_node']) > + > +def relevant(p): > +return not (filter & {el.current_element for el in p}) Is this used? Otherwise, I think it would be good to not warn about a use of kvfree if that use is reachable

Re: [PATCH v6] coccinelle: api: add kvfree script

2020-08-02 Thread Julia Lawall
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\| > > +

[PATCH v6] coccinelle: api: add kvfree script

2020-07-31 Thread Denis Efremov
Check that alloc and free types of functions match each other. Signed-off-by: Denis Efremov --- Changes in v2: - Lines are limited to 80 characters where possible - Confidence changed from High to Medium because of fs/btrfs/send.c:1119 false-positive - __vmalloc_area_node() explicitly