Re: [Cocci] [PATCH] coccinelle: misc: add excluded_middle.cocci script

2020-09-04 Thread Julia Lawall
On Wed, 2 Sep 2020, Denis Efremov wrote: > Check for "!A || A && B" condition. It's equivalent to > "!A || B" condition. > > Signed-off-by: Denis Efremov > --- > scripts/coccinelle/misc/excluded_middle.cocci | 40 +++ > 1 file changed, 40 insertions(+) > create mode 100644 sc

Re: [Cocci] transform oddity / bug ?

2020-09-04 Thread Julia Lawall
On Thu, 3 Sep 2020, Joe Perches wrote: > On Thu, 2020-09-03 at 17:14 +0200, Julia Lawall wrote: > > On Wed, 2 Sep 2020, Joe Perches wrote: > > > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote: > > > > On Wed, 2 Sep 2020, Joe Perches wrote: > > >

Re: [Cocci] transform oddity / bug ?

2020-09-03 Thread Julia Lawall
On Thu, 3 Sep 2020, Joe Perches wrote: > On Thu, 2020-09-03 at 17:14 +0200, Julia Lawall wrote: > > On Wed, 2 Sep 2020, Joe Perches wrote: > > > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote: > > > > On Wed, 2 Sep 2020, Joe Perches wrote: > > >

Re: [Cocci] transform oddity / bug ?

2020-09-03 Thread Julia Lawall
On Wed, 2 Sep 2020, Joe Perches wrote: > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote: > > > > On Wed, 2 Sep 2020, Joe Perches wrote: > > > > > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote: > > > > On Sun, 30 Aug 2020, Joe Perches wr

Re: [Cocci] transform oddity / bug ?

2020-09-02 Thread Julia Lawall
On Wed, 2 Sep 2020, Joe Perches wrote: > On Wed, 2020-09-02 at 22:46 +0200, Julia Lawall wrote: > > > > On Wed, 2 Sep 2020, Joe Perches wrote: > > > > > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote: > > > > On Sun, 30 Aug 2020, Joe Perches wr

Re: [Cocci] transform oddity / bug ?

2020-09-02 Thread Julia Lawall
On Wed, 2 Sep 2020, Joe Perches wrote: > On Sun, 2020-08-30 at 20:41 +0200, Julia Lawall wrote: > > On Sun, 30 Aug 2020, Joe Perches wrote: > > > On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote: > > > > Unfortunately this does not work when the declaration

Re: [Cocci] expression without side effects

2020-09-02 Thread Julia Lawall
On Wed, 2 Sep 2020, Denis Efremov wrote: > > > On 9/2/20 3:32 PM, Julia Lawall wrote: > > There is an isomorphism that you can disable: ptr_to_array > > Thanks! > > Anyway, even with ptr_to_array enabled equalizing cmd->dmap[0] and > cmd->dmap[1] looks inc

Re: [Cocci] expression without side effects

2020-09-02 Thread Julia Lawall
On Wed, 2 Sep 2020, Denis Efremov wrote: > Hi, > > I'm trying to write a pattern to match expression without side-effects, > i.e expression E but not i++, --i, function call. > > While trying to write it I faced that this expression matches different > array indices. Actually, it's quite unexpe

Re: [Cocci] [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions

2020-09-02 Thread Julia Lawall
On Wed, 2 Sep 2020, Markus Elfring wrote: > … > > +++ b/scripts/coccinelle/free/ifnullfree.cocci > > @@ -20,8 +20,14 @@ expression E; > > - if (E != NULL) > > ( > >kfree(E); > > +| > > + kvfree(E); > > | > >kfree_sensitive(E); > > +| > > + kvfree_sensitive(E, ...); > > +| > > + vfr

Re: [Cocci] [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions

2020-09-01 Thread Julia Lawall
On Wed, 2 Sep 2020, Denis Efremov wrote: > Extend the list of free functions with kvfree(), kvfree_sensitive(), > vfree(). > > Signed-off-by: Denis Efremov Applied, thanks. julia > --- > scripts/coccinelle/free/ifnullfree.cocci | 11 +-- > 1 file changed, 9 insertions(+), 2 deletio

Re: [Cocci] [PATCH v3] coccinelle: misc: add uninitialized_var.cocci script

2020-09-01 Thread Julia Lawall
On Tue, 1 Sep 2020, Denis Efremov wrote: > uninitialized_var() macro was removed from the sources [1] and > other warning-silencing tricks were deprecated [2]. The purpose of this > cocci script is to prevent new occurrences of uninitialized_var() > open-coded variants. > > [1] commit 63a0895d9

Re: [Cocci] [PATCH v2] coccinelle: misc: add uninitialized_var.cocci script

2020-09-01 Thread Julia Lawall
On Tue, 1 Sep 2020, Denis Efremov wrote: > Commit 63a0895d960a ("compiler: Remove uninitialized_var() macro") and > commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()") > removed uninitialized_var() and deprecated it. I'm not really sure to understand the above. How can somet

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Joe Perches wrote: > On Sun, 2020-08-30 at 17:46 +0200, Julia Lawall wrote: > > The following: > > > > @not_int_not_len exists@ > > type T != int; > > identifier x != len; > > position p; > > identifier sysfs =~

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
[...] > Thanks, I used the slightly different from your suggestion > where sysfs is an identifier with function args and a > semicolon after the transform type, (otherwise I get cocci errors). > like this below: > > But it doesn't work (no renaming) when there is an > initializer to the variable t

Re: [Cocci] transform oddity

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Markus Elfring wrote: > >> How do you think about to use the following transformation variant? > > > > This is uselessly expensive. It is already known that there is at least > > one occurrence of x. > > Would we like to care if the affected identifier should be updated mo

Re: [Cocci] transform oddity

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Markus Elfring wrote: > > - T x@p; > > + int len > > <... > > - x > > + len > > ...> > > How do you think about to use the following transformation variant? This is uselessly expensive. It is already known that there is at least one occurrence of x. julia > > -T x@p

Re: [Cocci] transform oddity / bug ?

2020-08-30 Thread Julia Lawall
On Sun, 30 Aug 2020, Joe Perches wrote: > On Sun, 2020-08-30 at 08:57 +0200, Julia Lawall wrote: > > > > On Sat, 29 Aug 2020, Joe Perches wrote: > > > > > Is it me not understanding cocci grammar again? > > > > The problem is the loop. You are tryin

Re: [Cocci] transform oddity / bug ?

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Joe Perches wrote: > Is it me not understanding cocci grammar again? The problem is the loop. You are trying to change something in the body of a loop and the body of a for loop might not be executed. ... means that the thing must be found on every execution path. Do yo

Re: [Cocci] [RFC PATCH] coccinelle: misc: add uninitialized_var.cocci script

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Denis Efremov wrote: > > > On 8/29/20 10:48 PM, Julia Lawall wrote: > > > > > > On Sat, 29 Aug 2020, Joe Perches wrote: > > > >> On Sat, 2020-08-29 at 21:36 +0200, Julia Lawall wrote: > >>> > >>> On Wed,

Re: [Cocci] [RFC PATCH] coccinelle: misc: add uninitialized_var.cocci script

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Joe Perches wrote: > On Sat, 2020-08-29 at 21:36 +0200, Julia Lawall wrote: > > > > On Wed, 12 Aug 2020, Denis Efremov wrote: > > > > > Commit 63a0895d960a ("compiler: Remove uninitialized_var() macro") and > > >

Re: [Cocci] [RFC PATCH] coccinelle: misc: add uninitialized_var.cocci script

2020-08-29 Thread Julia Lawall
On Wed, 12 Aug 2020, Denis Efremov wrote: > Commit 63a0895d960a ("compiler: Remove uninitialized_var() macro") and > commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()") > removed uninitialized_var() and deprecated it. > > The purpose of this script is to prevent new occurrence

Re: [Cocci] [RFC PATCH] coccinelle: api: add flex_array_size.cocci script

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Markus Elfring wrote: > > Suggest flex_array_size() wrapper to compute the size of a > > flexible array member in a structure. The macro additionally > > checks for integer overflows. > > Can the following script variant for the semantic patch language help > to clarify any

Re: [Cocci] Checking the application of a SmPL disjunction for a function call addition

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Markus Elfring wrote: > >> Will this information trigger further consequences for the clarification > >> of the topic “[RFC PATCH] coccinelle: api: add flex_array_size.cocci > >> script”? > >> https://lore.kernel.org/cocci/20200828163134.496386-1-efre...@linux.com/ > >> htt

Re: [Cocci] Checking the application of a SmPL disjunction for a function call addition

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Markus Elfring wrote: > >> @replacement@ > >> identifier array, instance, size; > >> type T; > >> @@ > >> ( > >> -sizeof(T) > >> | > >> -sizeof(*instance->array) > >> ) > >> * > >> +flex_array_size(instance, array, > >> instance->size > >> + )

Re: [Cocci] Checking the deletion of a multiplication operator with SmPL

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Markus Elfring wrote: > Hello, > > The following small script variant for the semantic patch language gets > accepted > according to the software combination “Coccinelle 1.0.8-00159-g730dbb03”. > > @replacement@ > identifier array, instance, size; > type T; > @@ > ( > -size

Re: [Cocci] Usage of a SmPL disjunction with sizeof()

2020-08-29 Thread Julia Lawall
On Sat, 29 Aug 2020, Markus Elfring wrote: > > No, you can't compbine a type and an expression in a disjunction. > > Such an information can be reconsidered once more > because the following script variant for the semantic patch language > gets accepted by the Coccinelle software. > > @display@

Re: [Cocci] Checking the usage of a SmPL disjunction within a sizeof()

2020-08-28 Thread Julia Lawall
On Fri, 28 Aug 2020, Markus Elfring wrote: > Hello, > > I have tried another tiny script variant out for the semantic patch language > (according to the software combination “Coccinelle 1.0.8-00159-g730dbb03”). > > @display@ > identifier array, instance; > type T; > @@ > *sizeof( \( T \| *(insta

Re: [Cocci] [PATCH] usb: atm: don't use snprintf() for sysfs attrs

2020-08-27 Thread Julia Lawall
On Fri, 28 Aug 2020, Denis Efremov wrote: > Hi all, > > On 8/27/20 10:42 PM, Julia Lawall wrote: > > > > > > On Thu, 27 Aug 2020, Joe Perches wrote: > > > >> On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote: > >>> On Thu, Aug 27, 2020

Re: [Cocci] [PATCH] usb: atm: don't use snprintf() for sysfs attrs

2020-08-27 Thread Julia Lawall
On Thu, 27 Aug 2020, Joe Perches wrote: > On Thu, 2020-08-27 at 21:42 +0200, Julia Lawall wrote: > > > > On Thu, 27 Aug 2020, Joe Perches wrote: > > > > > On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote: > > > > On Thu, Aug 27, 2020 at 03:41:06PM +

Re: [Cocci] [PATCH] usb: atm: don't use snprintf() for sysfs attrs

2020-08-27 Thread Julia Lawall
On Thu, 27 Aug 2020, Joe Perches wrote: > On Thu, 2020-08-27 at 15:48 +0100, Alex Dewar wrote: > > On Thu, Aug 27, 2020 at 03:41:06PM +0200, Rasmus Villemoes wrote: > > > On 27/08/2020 15.18, Alex Dewar wrote: > > > > On Thu, Aug 27, 2020 at 09:15:37AM +0200, Greg Kroah-Hartman wrote: > > > > >

Re: [Cocci] coccinelle: Convert comma to semicolons (was Re: [PATCH] checkpatch: Add test for comma use that should be semicolon)

2020-08-22 Thread Julia Lawall
On Fri, 21 Aug 2020, Joe Perches wrote: > On Fri, 2020-08-21 at 23:35 -0400, Valdis Klētnieks wrote: > > On Fri, 21 Aug 2020 18:08:08 -0700, Joe Perches said: > > > (forwarding on to kernel-janitors/mentees and kernelnewbies) > > > > > > Just fyi for anyone that cares: > > > > > > A janitorial t

Re: [Cocci] [PATCH v2] coccinelle: api: add kobj_to_dev.cocci script

2020-08-21 Thread Julia Lawall
On Fri, 21 Aug 2020, Denis Efremov wrote: > Use kobj_to_dev() instead of container_of(). > > Signed-off-by: Denis Efremov Applied, thanks. julia > --- > Changes in v2: > - "symbol kobj;" added to the rule r > > scripts/coccinelle/api/kobj_to_dev.cocci | 45 > 1 fi

Re: [Cocci] [PATCH] coccinelle: api: add kobj_to_dev.cocci script

2020-08-21 Thread Julia Lawall
On Fri, 21 Aug 2020, Denis Efremov wrote: > Use kobj_to_dev() instead of container_of(). Thanks for the patch and the example commits. Could you add symbol kobj; to the first rule? That's enough to get rid of the question about whether kobj should be a metavariable in all cases. thanks, j

Re: [Cocci] [PATCH] coccinelle: add patch rule for dma_alloc_coherent

2020-08-21 Thread Julia Lawall
On Fri, 21 Aug 2020, Alex Dewar wrote: > Commit dfd32cad146e ("dma-mapping: remove dma_zalloc_coherent()") > removed the definition of dma_zalloc_coherent() and also removed the > corresponding patch rule for replacing instances of dma_alloc_coherent + > memset in zalloc-simple.cocci (though le

Re: [Cocci] coccinelle: Convert comma to semicolons (was Re: [PATCH] checkpatch: Add test for comma use that should be semicolon)

2020-08-20 Thread Julia Lawall
On Wed, 19 Aug 2020, Joe Perches wrote: > On Wed, 2020-08-19 at 14:22 -0700, Joe Perches wrote: > > There are commas used as statement terminations that should typically > > have used semicolons instead. Only direct assignments or use of a single > > function or value on a single line are dete

Re: [Cocci] coccinelle: api: add sprintf() support to device_attr_show

2020-08-17 Thread Julia Lawall
On Mon, 17 Aug 2020, Markus Elfring wrote: > > What clarifications? > > Did you notice that my suggestion for the SmPL script variant > “scripts/coccinelle/api/device_attr_show.cocci” > can generate a patch? > https://lore.kernel.org/cocci/0a9015b6-9037-59c5-31f2-cd2b32c86...@linux.com/ > > Unf

Re: [Cocci] coccinelle: api: add sprintf() support to device_attr_show

2020-08-17 Thread Julia Lawall
On Mon, 17 Aug 2020, Markus Elfring wrote: > >> Can missing source code matches trigger the consequence that questionable > >> branches would be applied there? > > > > No. > > I imagine that corresponding views will need further clarifications. What clarifications? In the failing_andany exampl

Re: [Cocci] coccinelle: api: add sprintf() support to device_attr_show

2020-08-17 Thread Julia Lawall
On Mon, 17 Aug 2020, Markus Elfring wrote: > > The problem has nothing to do with disjunctions. > > Can missing source code matches trigger the consequence that questionable > branches would be applied there? No. The problem causes transformations that should be applied not to be applied. jul

Re: [Cocci] coccinelle: api: add sprintf() support to device_attr_show

2020-08-17 Thread Julia Lawall
On Mon, 17 Aug 2020, Markus Elfring wrote: > > I will see if it can be fixed. > > How will the issue “failing tests - TODO” evolve further? > https://github.com/coccinelle/coccinelle/commit/f2d7ec9006c89610bd1aab4662fcf100e3e6d469#diff-13ff769079511ec7b5dddef7143b2b93R1 failing_andany.cocci is

Re: [Cocci] Searching for format strings with SmPL disjunctions

2020-08-16 Thread Julia Lawall
On Sun, 16 Aug 2020, Markus Elfring wrote: > Can a source code search pattern like the following become ever usable? > > @display@ > @@ > *"%" > ("d" > |"ld" > |"lld" > ) > ("\n" > |"" > ) > > > elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch --parse-cocci > show_usage_of_selected_format_stri

Re: [Cocci] [PATCH] coccinelle: api: add sprintf() support to device_attr_show

2020-08-15 Thread Julia Lawall
> With this patch it generates nothing. I would expect spatch to generate > a different patch with sprintf instead of scnprintf, because I think > ... is enough to match "*(int *)(ea->var)". Even if it can't match sprintf > pattern it should fallback to scnprintf pattern. It's a known bug, explain

Re: [Cocci] [PATCH] scripts: coccicheck: Change default value for parallelism

2020-08-13 Thread Julia Lawall
On Thu, 13 Aug 2020, Sumera Priyadarsini wrote: > > > On Thu, 13 Aug, 2020, 1:45 AM Julia Lawall, wrote: > > > On Wed, 12 Aug 2020, Sumera Priyadarsini wrote: > > > By default, coccicheck utilizes all available threads to implement > &g

Re: [Cocci] [PATCH] scripts: coccicheck: Change default value for parallelism

2020-08-12 Thread Julia Lawall
On Wed, 12 Aug 2020, Sumera Priyadarsini wrote: > By default, coccicheck utilizes all available threads to implement > parallelisation. However, when hyperthreading is enabled, this leads > to all threads per core being occupied resulting in longer wall-clock > times and higher power consumptio

Re: [Cocci] [RFC PATCH] coccinelle: misc: add uninitialized_var.cocci script

2020-08-12 Thread Julia Lawall
On Wed, 12 Aug 2020, Markus Elfring wrote: > > +@r@ > > +identifier var; > > +type T; > > +position p; > > +@@ > > + > > +( > > +* T var@p = var; > > +| > > +* T var@p = *(&(var)); > > I suggest to simplify such code for the semantic patch language a bit. > Can an other variant be more succinct

Re: [Cocci] [PATCH v4] documentation: coccinelle: Improve command example for make C={1, 2}

2020-08-11 Thread Julia Lawall
On Tue, 11 Aug 2020, Sumera Priyadarsini wrote: > Modify coccinelle documentation to further clarify > the usage of the makefile C variable by coccicheck. > > Signed-off-by: Sumera Priyadarsini Acked-by: Julia Lawall Thanks. > > --- > Changes in v4: > -

Re: [Cocci] [PATCH v3] documentation: coccinelle: Improve command example for make C={1, 2}

2020-08-10 Thread Julia Lawall
On Mon, 10 Aug 2020, Markus Elfring wrote: > > the usage of the makefile C variable flag by coccicheck. > > * Can it be confusing to denote an item as a variable and a flag? > > * Would you really like to stress here that a flag can be variable? This is not part of the documentation, so it does

Re: [Cocci] [PATCH v3] documentation: coccinelle: Improve command example for make C={1, 2}

2020-08-10 Thread Julia Lawall
On Mon, 10 Aug 2020, Sumera Priyadarsini wrote: > Modify coccinelle documentation to further clarify > the usage of the makefile C variable flag by coccicheck. > > Signed-off-by: Sumera Priyadarsini Thanks. Acked-by: Julia Lawall > > --- > Changes in v3: >

Re: [Cocci] [PATCH v2] documentation: coccinelle: Improve command example for make C={1, 2}

2020-08-10 Thread Julia Lawall
On Mon, 10 Aug 2020, Jonathan Corbet wrote: > On Mon, 10 Aug 2020 09:30:18 +0200 > Markus Elfring wrote: > > > > Modify coccinelle documentation to further clarify > > > the usage of the makefile C variable flag by coccicheck. > > > > How do you think about a wording variant like the following

Re: [Cocci] [PATCH] Coccinelle: Reduce duplicate code for patch rules of memdup_user.cocci

2020-08-09 Thread Julia Lawall
On Sun, 9 Aug 2020, Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 9 Aug 2020 11:11:20 +0200 > > Another patch rule was added. A bit of code was copied from a previous > SmPL rule for this change specification. > > * Thus reduce duplicate code by using another SmPL disjunction. I d

Re: [Cocci] [PATCH] documentation: coccinelle: Improve command example

2020-08-07 Thread Julia Lawall
On Fri, 7 Aug 2020, Sumera Priyadarsini wrote: > This patch modifies the coccinelle documentation to add further > description for the usage of the C variable flags by coccicheck. > > Signed-off-by: Sumera Priyadarsini > --- > Documentation/dev-tools/coccinelle.rst | 5 - > 1 file changed

Re: [Cocci] [PATCH v2] scripts: coccicheck: Add chain mode to list of modes

2020-08-05 Thread Julia Lawall
On Wed, 5 Aug 2020, Sumera Priyadarsini wrote: > This patch adds chain mode to the list of available modes in coccicheck. Applied, Thanks! julia > > Signed-off-by: Sumera Priyadarsini > --- > Changes in v2: > - Change coccinelle to coccicheck as suggest

Re: [Cocci] [PATCH] scripts: coccicheck: Add chain mode to list of modes

2020-08-04 Thread Julia Lawall
On Tue, 4 Aug 2020, Sumera Priyadarsini wrote: > This patch adds chain mode to the list of available modes in coccinelle. Thanks for the commit. In the log message, could you change "coccinelle" o "coccicheck"? Actually, the modes are not something that are built into Coccinelle. They are j

Re: [Cocci] [PATCH v3] coccinelle: api: add kvmalloc script

2020-08-04 Thread Julia Lawall
On Tue, 4 Aug 2020, Markus Elfring wrote: > > Changes in v3: > > - kvfree rules added > > I find it interesting to you found such an addition needed for this SmPL > script. > I imagine that it can be helpful to support such a source code search by > a separate script for the semantic patch lan

Re: [Cocci] [PATCH] coccinelle: api: add kvmalloc script

2020-08-03 Thread Julia Lawall
On Mon, 3 Aug 2020, Markus Elfring wrote: > … > > +++ b/scripts/coccinelle/api/kvmalloc.cocci > … > > +@opportunity depends on !patch@ > > +expression E, E1, size; > > +position p; > > +@@ > > + > > +( > … > > +| > > +* E = \(kmalloc\|kzalloc\|kcalloc\|kmalloc_node\|kzalloc_node\| > > +* k

Re: [Cocci] [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 re

Re: [Cocci] [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: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Mon, 3 Aug 2020, Markus Elfring wrote: > >> Do you care if a SmPL name variable would accidentally not be used > >> (like in the script > >> “https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/tests/metaattr.cocci#L2”)? > > > > It actually is used, to help

Re: [Cocci] [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: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >> How do you distinguish between metavariables and other SmPL variables then? > > > > Metavariables don't have "name" in their declaration. There is a sentence > > about that in the documentation. > > > > The {\bf name} modifier specifies that instea

Re: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >>> attribute name __attr__; declares that __attr__ is the name of an > >>> attribute. > >> > >> Is this specification also a declaration of a metavariable? > > > > No. > > How do you distinguish between metavariables and other SmPL variables then? M

Re: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >> How do you call the following items in the update step “[PATCH 42/43] > >> tests: > >> Add test case to match meta attribute”? > >> https://lore.kernel.org/cocci/25fb4894-65d3-dc57-dbfd-93d3482d8...@web.de/ > >> https://systeme.lip6.fr/pipermail/co

Re: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >> Will the Coccinelle software itself present a warning like “metavariable > >> __attr__ > >> not used in the - or context code”? > > > > No. It's not a metavariable. > > How do you call the following items in the update step “[PATCH 42/43] tests: >

Re: [Cocci] [00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >> Would you like to integrate corresponding patches for known open issues > >> (a bit later) then? > > > > No, the code is fine. > > Will the Coccinelle software itself present a warning like “metavariable > __attr__ > not used in the - or context co

Re: [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > >>> Applied. > >> > >> Does this information indicate that you do not care for specific > >> patch review concerns according to these test cases at the moment? > > > > Yes, that's what it means. > > Would you like to integrate corresponding patches fo

Re: [Cocci] [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\| > > +kmalloc_array\|

Re: [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL

2020-08-02 Thread Julia Lawall
On Sun, 2 Aug 2020, Markus Elfring wrote: > > > Two test cases are included for detecting and removing meta attributes. > > > > Applied. > > Does this information indicate that you do not care for specific > patch review concerns according to these test cases at the moment? Yes, that's what it

Re: [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL

2020-08-01 Thread Julia Lawall
On Sun, 26 Jul 2020, Jaskaran Singh wrote: > This patch series aims to add support for meta attributes in SmPL. > Currently, only meta attributes in context and minus code are supported. > > Changes include adding the MetaAttribute and MetaAttributeDecl constructors to > the SmPL ASTs and the M

Re: [Cocci] Match variable declaration with init expression

2020-07-31 Thread Julia Lawall
On Fri, 31 Jul 2020, Denis Efremov wrote: > Hi, > > This pattern: > - E = kzalloc(size, flags | __GFP_NOWARN); > - if (\(!E\|E == null\))@p > - E = vzalloc(size); > + E = kvzalloc(size, flags); > > matches this code: > void *p; > p = kzalloc(size, gfp | __GFP_NOWARN); > > if (!p) > p =

Re: [Cocci] [v4] coccinelle: api: add kvfree script

2020-07-31 Thread Julia Lawall
On Fri, 31 Jul 2020, Markus Elfring wrote: > > +msg = "WARNING: kmalloc is used to allocate this memory at line %s" % > > (k[0].line) > > +coccilib.org.print_todo(p[0], msg) > > * I find the diagnostic text insufficient. > >>> > >>> I also find the message not very inform

Re: [Cocci] [PATCH v4] coccinelle: api: add kvfree script

2020-07-31 Thread Julia Lawall
> > > > Do the checks for the opportunities for kvmalloc really belong in this > > rule? That issue is not mentioned in the commit log or the description of > > the semantic patch. > > I added this at the last moment. It was easy enough to add it based on > existing > patterns. I will add descrip

Re: [Cocci] [PATCH v4] coccinelle: api: add kvfree script

2020-07-31 Thread Julia Lawall
On Fri, 31 Jul 2020, Markus Elfring wrote: > >>> +msg = "WARNING: kmalloc is used to allocate this memory at line %s" % > >>> (k[0].line) > >>> +coccilib.org.print_todo(p[0], msg) > >> > >> * I find the diagnostic text insufficient. > > > > I also find the message not very informative. > > Is i

Re: [Cocci] [PATCH v4] coccinelle: api: add kvfree script

2020-07-30 Thread Julia Lawall
On Thu, 30 Jul 2020, Denis Efremov wrote: > Check that alloc and free types of functions match each other. Do the checks for the opportunities for kvmalloc really belong in this rule? That issue is not mentioned in the commit log or the description of the semantic patch. With the current pat

Re: [Cocci] [PATCH v4] coccinelle: api: add kvfree script

2020-07-30 Thread Julia Lawall
Actually, the message looks fine. Sorry for the noise about that. However there is a problem in the kfree case: > +@kfree depends on !patch@ > +expression E; > +position v != choice.vok; > +position p; > +@@ > + > +* E = > \(vmalloc@v\|vzalloc@v\|vmalloc_user@v\|vmalloc_node@v\|vzalloc_node@v\|

Re: [Cocci] [PATCH v4] coccinelle: api: add kvfree script

2020-07-30 Thread Julia Lawall
> > +msg = "WARNING: kmalloc is used to allocate this memory at line %s" % > > (k[0].line) > > +coccilib.org.print_todo(p[0], msg) > > * I find the diagnostic text insufficient. I also find the message not very informative. All of the other comments are not useful, and some are simply incorrect.

Re: [Cocci] [PATCH v3 0/3] Update memdup_user.cocci

2020-07-24 Thread Julia Lawall
On Mon, 20 Jul 2020, Denis Efremov wrote: > Add GFP_USER to the allocation flags and handle vmemdup_user(). > > Changes in v2: > - memdup_user/vmemdup_user matching suppressed > - PoC for selfcheck virtual rule > Changes in v3: > - add missing '-' for patch rule in kmalloc/kzalloc call args

Re: [Cocci] [v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()

2020-07-21 Thread Julia Lawall
On Wed, 22 Jul 2020, Markus Elfring wrote: > > Markus, you are welcome to try this since you are concerned about it. > > I dare to point software design variations for some reasons. > > > > But it doesn't matter. > > Under which circumstances would you begin to care more for involved > differe

Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()

2020-07-21 Thread Julia Lawall
On Wed, 22 Jul 2020, Markus Elfring wrote: > >>> +@depends on patch@ > >>> +expression from,to,size; > >>> +identifier l1,l2; > >>> +@@ > >>> + > >>> +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\)); > >>> ++ to = vmemdup_user(from,size); > >> > >> I propose to combine the desired

Re: [Cocci] [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user()

2020-07-21 Thread Julia Lawall
On Tue, 21 Jul 2020, Markus Elfring wrote: > … > > +++ b/scripts/coccinelle/api/memdup_user.cocci > > @@ -39,6 +39,28 @@ … > … > > +@depends on patch@ > > +expression from,to,size; > > +identifier l1,l2; > > +@@ > > + > > +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\)); > > ++ to

Re: [Cocci] [PATCH 00/17] parsing_cocci: Add attributefn to the SmPL AST visitor

2020-07-18 Thread Julia Lawall
On Thu, 16 Jul 2020, Jaskaran Singh wrote: > This patch series aims to add a public function for visiting attributes > to the SmPL AST visitor. This is needed to support meta attributes. Applied. Thanks. > > Jaskaran Singh (17): > parsing_cocci: visitor_ast: Add attributefn to SmPL AST

Re: [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor

2020-07-18 Thread Julia Lawall
On Thu, 16 Jul 2020, Jaskaran Singh wrote: > This patch series aims to add a public function for visiting attributes > to the SmPL AST0 visitor. This is needed to support meta attributes. An > AttributeTag constructor is also added due to dependencies, as well as > to maintain consistency with

Re: [Cocci] [v2 1/4] coccinelle: api: extend memdup_user transformation with GFP_USER

2020-07-18 Thread Julia Lawall
On Sat, 18 Jul 2020, Denis Efremov wrote: > Hi, > > On 7/18/20 9:45 AM, Julia Lawall wrote: > > This on is indeed a problem. I think it was not detected in testing, > > because in the current kernel the rule never applies. But Denis, in > > >

Re: [Cocci] [v2 1/4] coccinelle: api: extend memdup_user transformation with GFP_USER

2020-07-18 Thread Julia Lawall
On Sat, 18 Jul 2020, Markus Elfring wrote: > >>> Applied. > >> > >> Do you care for patch review concerns according to this SmPL script > >> adjustment? > >> > >> * > >> https://lore.kernel.org/cocci/5c0dae88-e172-3ba6-f86c-d1a6238bb...@web.de/ > >> https://lkml.org/lkml/2020/6/9/568 > > > >

Re: [Cocci] [v2 1/4] coccinelle: api: extend memdup_user transformation with GFP_USER

2020-07-17 Thread Julia Lawall
On Sat, 18 Jul 2020, Markus Elfring wrote: > > Applied. > > Do you care for patch review concerns according to this SmPL script > adjustment? > > * https://lore.kernel.org/cocci/5c0dae88-e172-3ba6-f86c-d1a6238bb...@web.de/ > https://lkml.org/lkml/2020/6/9/568 This one it complete nonsense.

Re: [Cocci] [PATCH v2 1/4] coccinelle: api: extend memdup_user transformation with GFP_USER

2020-07-17 Thread Julia Lawall
On Mon, 8 Jun 2020, Denis Efremov wrote: > Match GFP_USER and optional __GFP_NOWARN allocations with > memdup_user.cocci rule. > Commit 6c2c97a24f09 ("memdup_user(): switch to GFP_USER") switched > memdup_user() from GFP_KERNEL to GFP_USER. In almost all cases it > is still a good idea to recom

Re: [Cocci] [PATCH v4] coccinelle: api: add kzfree script

2020-07-17 Thread Julia Lawall
On Fri, 17 Jul 2020, Denis Efremov wrote: > Check for memset()/memzero_explicit() followed by kfree()/vfree()/kvfree(). > > Signed-off-by: Denis Efremov Applied. > --- > Changes in v2: > - memset_explicit() added > - kvfree_sensitive() added > - forall added to r1 > - ... between memset

Re: [Cocci] [PATCH] parsing_cocci: parse_cocci: Extend is_permissible_proto list

2020-07-11 Thread Julia Lawall
On Sat, 11 Jul 2020, Jaskaran Singh wrote: > Add more tokens (binary operators and colon) to the match ladder in > is_permissible_proto. These cases would otherwise cause parsing errors > for function calls after these tokens. Thanks, but it doesn't apply: Applying: parsing_cocci: parse_cocci

Re: [Cocci] [PATCH v2 RESEND 00/20] parsing_cocci: Wrap SmPL Attributes

2020-07-08 Thread Julia Lawall
On Wed, 8 Jul 2020, Jaskaran Singh wrote: > This patch series aims to wrap the existing attribute type on the SmPL > side. Wrapping attributes is necessary to add support for meta > attributes in SmPL. Applied. I would like to take the opportunity to thank Collabora for funding the completio

Re: [Cocci] [PATCH v3] coccinelle: api: add kzfree script

2020-07-07 Thread Julia Lawall
On Mon, 15 Jun 2020, Denis Efremov wrote: > Check for memset()/memzero_explicit() followed by kfree()/vfree()/kvfree(). > > Signed-off-by: Denis Efremov > --- > Changes in v2: > - memset_explicit() added > - kvfree_sensitive() added > - forall added to r1 > - ... between memset and kfree a

Re: [Cocci] Adding labels without indentation before specific statements?

2020-07-07 Thread Julia Lawall
On Tue, 7 Jul 2020, Markus Elfring wrote: > Hello, > > I have tried another tiny script variant out for the semantic patch language > (according to the software combination “Coccinelle 1.0.8-00139-gd0fd4c7d”). > > @addition@ > identifier work; > expression action; > @@ > void work(...) > { >

Re: [Cocci] [PATCH 02/20] parsing_cocci: parser: Wrap SmPL Attributes

2020-07-06 Thread Julia Lawall
On Fri, 3 Jul 2020, Jaskaran Singh wrote: > Attributes are wrapped in the SmPL AST. Reciprocate this and wrap > attributes in the SmPL parser. This doesn't apply for me. julia > > Signed-off-by: Jaskaran Singh > --- > parsing_cocci/parse_aux.ml| 3 +++ > parsing_cocci/parse_a

Re: [Cocci] [PATCH 05/20] parsing_cocci: arity: Wrap SmPL Attributes

2020-07-06 Thread Julia Lawall
On Fri, 3 Jul 2020, Jaskaran Singh wrote: > Attributes are wrapped in the SmPL AST. Reflect these changes in > arity.ml. This gives some space before tab errors. julia > > Signed-off-by: Jaskaran Singh > --- > parsing_cocci/arity.ml | 67 +++--- > 1 file

Re: [Cocci] [v2] Documentation: Coccinelle: fix typos and command example

2020-07-01 Thread Julia Lawall
On Thu, 2 Jul 2020, Matthew Wilcox wrote: > On Wed, Jul 01, 2020 at 07:52:58AM -0700, Randy Dunlap wrote: > > On 7/1/20 6:32 AM, Markus Elfring wrote: > > >>> How do you think about to use the following command variant > > >>> for the adjustment of the software documentation? > > >>> > > >>> +

Re: [Cocci] [PATCH v3] Documentation: Coccinelle: fix various typos etc.

2020-07-01 Thread Julia Lawall
On Wed, 1 Jul 2020, Randy Dunlap wrote: > From: Randy Dunlap > > Fix various typos etc. in dev-tools/coccinelle.rst: > > - punctuation, grammar, wording Acked-by: Julia Lawall Thanks! julia > > Signed-off-by: Randy Dunlap > Cc: Julia Lawall > Cc: Gilles

Re: [Cocci] [PATCH v2] Documentation: Coccinelle: fix typos and command example

2020-07-01 Thread Julia Lawall
On Mon, 29 Jun 2020, Randy Dunlap wrote: > From: Randy Dunlap > > Fix various typos etc. in dev-tools/coccinelle.rst: > > - punctuation, grammar, wording > - add "path/to/file.c" when using Coccinelle to check a single file > > Signed-off-by: Randy Dunlap

Re: [Cocci] [PATCH] Documentation: Coccinelle: fix typos and command example

2020-06-29 Thread Julia Lawall
> As Coccinelle features get added some more advanced SmPL patches > may require newer versions of Coccinelle. If an SmPL patch requires > -at least a version of Coccinelle, this can be specified as follows, > +at minimum version of Coccinelle, this can be specified as follows, at -> a thanks,

Re: [Cocci] Checking the parsing for a nested SmPL disjunction

2020-06-26 Thread Julia Lawall
On Fri, 26 Jun 2020, Markus Elfring wrote: > I assumed that I may omit the semicolon in such a SmPL code. > Can the specification of a SmPL nest construct ever be sufficient here? > >>> > >>> No. <+... ...+> matches a subtree of an AST. For a variable > >>> initialization, there is

Re: [Cocci] Checking the parsing for a nested SmPL disjunction

2020-06-26 Thread Julia Lawall
On Fri, 26 Jun 2020, Markus Elfring wrote: > >> I assumed that I may omit the semicolon in such a SmPL code. > >> Can the specification of a SmPL nest construct ever be sufficient here? > > > > No. <+... ...+> matches a subtree of an AST. For a variable > > initialization, there is no subtree

Re: [Cocci] Checking the parsing for a nested SmPL disjunction

2020-06-26 Thread Julia Lawall
On Fri, 26 Jun 2020, Markus Elfring wrote: > >> <+... when any > >> (t2 y = <+... > >> ( sizeof(*(resource)) > >> | > >> * *(resource) > >> ) ...+> > > > > You are missing a ; here. > > I assumed that I may omit the semicolon in such a SmPL code. > Can the specification of a

Re: [Cocci] Checking the parsing for a nested SmPL disjunction

2020-06-26 Thread Julia Lawall
On Fri, 26 Jun 2020, Markus Elfring wrote: > Hello, > > I have tried another small script variant out for the semantic patch language > (according to the software combination “Coccinelle 1.0.8-00131-g675b9670”). > > @display@ > type t1, t2; > expression action; > identifier resource, y; > statem

Re: [Cocci] Checking the display of SmPL isomorphism results (with pointers)

2020-06-26 Thread Julia Lawall
On Fri, 26 Jun 2020, Markus Elfring wrote: > Hello, > > I have tried another tiny script variant out for the semantic patch language > (according to the software combination “Coccinelle 1.0.8-00131-g675b9670”). > > @display@ > expression* x; > statement is, es; > @@ > *if (!x) > is > else >

<    1   2   3   4   5   6   7   8   9   10   >