* [Cocci] [PATCH 0/5] Coccinelle: put_device: Adjustments for a SmPL script
@ 2019-05-13 8:55 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 8:55 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
Some adjustments were discussed also for this script a while ago.
The software development attention evolved in a special way in the meantime.
See also for further background information:
https://lore.kernel.org/lkml/CAK7LNATjAsiSeZoTZ57zBHse0j5ZYY_12ZQ0gaF_oCziUWheOQ@mail.gmail.com/
https://systeme.lip6.fr/pipermail/cocci/2019-March/005692.html
https://lkml.org/lkml/2019/3/26/395
I would appreciate if corresponding implementation details will get
another look.
Markus Elfring (5):
Adjust a message construction
Add a cast to an expression for an assignment
Merge four SmPL when constraints into one
Extend when constraints for two SmPL ellipses
Merge two SmPL when constraints into one
scripts/coccinelle/free/put_device.cocci | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 8:59 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 8:59 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 May 2019 11:20:48 +0200
The Linux coding style tolerates long string literals so that
the provided information can be easier found also by search tools
like grep.
Thus simplify a message construction in a SmPL rule by concatenating text
with two plus operators less.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index c9f071b0a0ab..3ebebc064f10 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -42,11 +42,10 @@ p1 << search.p1;
p2 << search.p2;
@@
-coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
- + "call of_find_device_by_node on line "
- + p1[0].line
- + ", but without a corresponding object release "
- + "within this function.")
+coccilib.report.print_report(p2[0],
+ "ERROR: missing put_device; call of_find_device_by_node on line "
+ + p1[0].line
+ + ", but without a corresponding object release within this function.")
@script:python depends on org@
p1 << search.p1;
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
@ 2019-05-13 8:59 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 8:59 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 7 May 2019 11:20:48 +0200
The Linux coding style tolerates long string literals so that
the provided information can be easier found also by search tools
like grep.
Thus simplify a message construction in a SmPL rule by concatenating text
with two plus operators less.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index c9f071b0a0ab..3ebebc064f10 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -42,11 +42,10 @@ p1 << search.p1;
p2 << search.p2;
@@
-coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
- + "call of_find_device_by_node on line "
- + p1[0].line
- + ", but without a corresponding object release "
- + "within this function.")
+coccilib.report.print_report(p2[0],
+ "ERROR: missing put_device; call of_find_device_by_node on line "
+ + p1[0].line
+ + ", but without a corresponding object release within this function.")
@script:python depends on org@
p1 << search.p1;
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 8:59 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:35 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:35 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 7 May 2019 11:20:48 +0200
>
> The Linux coding style tolerates long string literals so that
> the provided information can be easier found also by search tools
> like grep.
> Thus simplify a message construction in a SmPL rule by concatenating text
> with two plus operators less.
I don't know python very well. Is there any way to unindent, so that the
string doesn't exceed 80 characters, or at least no so much?
On the other hand, I would have much preferred the original msg = code. I
don't understand why it is so offensive.
julia
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index c9f071b0a0ab..3ebebc064f10 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -42,11 +42,10 @@ p1 << search.p1;
> p2 << search.p2;
> @@
>
> -coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
> - + "call of_find_device_by_node on line "
> - + p1[0].line
> - + ", but without a corresponding object release "
> - + "within this function.")
> +coccilib.report.print_report(p2[0],
> + "ERROR: missing put_device; call of_find_device_by_node on line "
> + + p1[0].line
> + + ", but without a corresponding object release within this function.")
>
> @script:python depends on org@
> p1 << search.p1;
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
@ 2019-05-13 9:35 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:35 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 7 May 2019 11:20:48 +0200
>
> The Linux coding style tolerates long string literals so that
> the provided information can be easier found also by search tools
> like grep.
> Thus simplify a message construction in a SmPL rule by concatenating text
> with two plus operators less.
I don't know python very well. Is there any way to unindent, so that the
string doesn't exceed 80 characters, or at least no so much?
On the other hand, I would have much preferred the original msg = code. I
don't understand why it is so offensive.
julia
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index c9f071b0a0ab..3ebebc064f10 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -42,11 +42,10 @@ p1 << search.p1;
> p2 << search.p2;
> @@
>
> -coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
> - + "call of_find_device_by_node on line "
> - + p1[0].line
> - + ", but without a corresponding object release "
> - + "within this function.")
> +coccilib.report.print_report(p2[0],
> + "ERROR: missing put_device; call of_find_device_by_node on line "
> + + p1[0].line
> + + ", but without a corresponding object release within this function.")
>
> @script:python depends on org@
> p1 << search.p1;
> --
> 2.21.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 9:35 ` [Cocci] " Julia Lawall
@ 2019-05-13 11:33 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:33 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> Thus simplify a message construction in a SmPL rule by concatenating text
>> with two plus operators less.
>
> Is there any way to unindent, so that the string doesn't exceed 80 characters,
> or at least no so much?
How does your concern fit to the string literal tolerance from
the Linux coding style?
> On the other hand, I would have much preferred the original msg = code.
> I don't understand why it is so offensive.
I suggested again to avoid the use of extra variables in such cases
(also in the discussed bit of Python source code within a SmPL script).
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [1/5] Coccinelle: put_device: Adjust a message construction
@ 2019-05-13 11:33 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:33 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> Thus simplify a message construction in a SmPL rule by concatenating text
>> with two plus operators less.
>
> Is there any way to unindent, so that the string doesn't exceed 80 characters,
> or at least no so much?
How does your concern fit to the string literal tolerance from
the Linux coding style?
> On the other hand, I would have much preferred the original msg = code.
> I don't understand why it is so offensive.
I suggested again to avoid the use of extra variables in such cases
(also in the discussed bit of Python source code within a SmPL script).
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 11:33 ` [Cocci] " Markus Elfring
@ 2019-05-13 11:36 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 11:36 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> >> Thus simplify a message construction in a SmPL rule by concatenating text
> >> with two plus operators less.
> >
> > Is there any way to unindent, so that the string doesn't exceed 80 characters,
> > or at least no so much?
>
> How does your concern fit to the string literal tolerance from
> the Linux coding style?
The point of view of the Linux kernel is that if there is no nicer way to
persent the string, exceeding 80 characters is preferable to breaking the
string. But here, at least if Python was not indentation sensitive, there
are much nicer ways to present the string and not exceed 80 characters.
> > On the other hand, I would have much preferred the original msg = code.
> > I don't understand why it is so offensive.
>
> I suggested again to avoid the use of extra variables in such cases
> (also in the discussed bit of Python source code within a SmPL script).
I realize that you don't like it, although I have no idea why. Does it
make the code slower? Less reliable? Less readable? I doubt any of those
things. I think that staying within 80 characters would be a much greater
benefit that all of these baseless concerns.
julia
>
> Regards,
> Markus
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [1/5] Coccinelle: put_device: Adjust a message construction
@ 2019-05-13 11:36 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 11:36 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> >> Thus simplify a message construction in a SmPL rule by concatenating text
> >> with two plus operators less.
> >
> > Is there any way to unindent, so that the string doesn't exceed 80 characters,
> > or at least no so much?
>
> How does your concern fit to the string literal tolerance from
> the Linux coding style?
The point of view of the Linux kernel is that if there is no nicer way to
persent the string, exceeding 80 characters is preferable to breaking the
string. But here, at least if Python was not indentation sensitive, there
are much nicer ways to present the string and not exceed 80 characters.
> > On the other hand, I would have much preferred the original msg = code.
> > I don't understand why it is so offensive.
>
> I suggested again to avoid the use of extra variables in such cases
> (also in the discussed bit of Python source code within a SmPL script).
I realize that you don't like it, although I have no idea why. Does it
make the code slower? Less reliable? Less readable? I doubt any of those
things. I think that staying within 80 characters would be a much greater
benefit that all of these baseless concerns.
julia
>
> Regards,
> Markus
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 11:36 ` [Cocci] " Julia Lawall
@ 2019-05-13 12:48 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:48 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
> I realize that you don't like it, although I have no idea why.
> Does it make the code slower?
Would you like to compare the run time characteristics from creating and
looking up an identifier for a Python variable to direct passing of
a concatenated string for the desired function call?
> I think that staying within 80 characters would be a much greater
> benefit that all of these baseless concerns.
Are you aware of another code formatting option?
https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
2019-05-13 8:59 ` [Cocci] " Markus Elfring
@ 2019-07-06 13:13 ` Masahiro Yamada
-1 siblings, 0 replies; 92+ messages in thread
From: Masahiro Yamada @ 2019-07-06 13:13 UTC (permalink / raw)
To: Markus Elfring
Cc: Julia Lawall, Gilles Muller, Michal Marek, Nicolas Palix,
Wen Yang, Yi Wang, cocci, Linux Kernel Mailing List
On Mon, May 13, 2019 at 5:59 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 7 May 2019 11:20:48 +0200
>
> The Linux coding style tolerates long string literals so that
> the provided information can be easier found also by search tools
> like grep.
> Thus simplify a message construction in a SmPL rule by concatenating text
> with two plus operators less.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
Applied to linux-kbuild.
> scripts/coccinelle/free/put_device.cocci | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index c9f071b0a0ab..3ebebc064f10 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -42,11 +42,10 @@ p1 << search.p1;
> p2 << search.p2;
> @@
>
> -coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
> - + "call of_find_device_by_node on line "
> - + p1[0].line
> - + ", but without a corresponding object release "
> - + "within this function.")
> +coccilib.report.print_report(p2[0],
> + "ERROR: missing put_device; call of_find_device_by_node on line "
> + + p1[0].line
> + + ", but without a corresponding object release within this function.")
>
> @script:python depends on org@
> p1 << search.p1;
> --
> 2.21.0
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 1/5] Coccinelle: put_device: Adjust a message construction
@ 2019-07-06 13:13 ` Masahiro Yamada
0 siblings, 0 replies; 92+ messages in thread
From: Masahiro Yamada @ 2019-07-06 13:13 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, Linux Kernel Mailing List,
cocci, Wen Yang
On Mon, May 13, 2019 at 5:59 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 7 May 2019 11:20:48 +0200
>
> The Linux coding style tolerates long string literals so that
> the provided information can be easier found also by search tools
> like grep.
> Thus simplify a message construction in a SmPL rule by concatenating text
> with two plus operators less.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
Applied to linux-kbuild.
> scripts/coccinelle/free/put_device.cocci | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index c9f071b0a0ab..3ebebc064f10 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -42,11 +42,10 @@ p1 << search.p1;
> p2 << search.p2;
> @@
>
> -coccilib.report.print_report(p2[0], "ERROR: missing put_device; "
> - + "call of_find_device_by_node on line "
> - + p1[0].line
> - + ", but without a corresponding object release "
> - + "within this function.")
> +coccilib.report.print_report(p2[0],
> + "ERROR: missing put_device; call of_find_device_by_node on line "
> + + p1[0].line
> + + ", but without a corresponding object release within this function.")
>
> @script:python depends on org@
> p1 << search.p1;
> --
> 2.21.0
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
--
Best Regards
Masahiro Yamada
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:01 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:01 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 May 2019 13:50:49 +0200
Extend a when constraint in a SmPL rule so that an additional cast
is optionally excluded from source code searches for an expression
in assignments.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
---
scripts/coccinelle/free/put_device.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 3ebebc064f10..120921366e84 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = (T)id
- when != e1 = &id->dev
+ when != e1 = (T)(&id->dev)
when != e1 = get_device(&id->dev)
when != e1 = (T1)platform_get_drvdata(id)
(
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
@ 2019-05-13 9:01 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:01 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 8 May 2019 13:50:49 +0200
Extend a when constraint in a SmPL rule so that an additional cast
is optionally excluded from source code searches for an expression
in assignments.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
---
scripts/coccinelle/free/put_device.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 3ebebc064f10..120921366e84 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = (T)id
- when != e1 = &id->dev
+ when != e1 = (T)(&id->dev)
when != e1 = get_device(&id->dev)
when != e1 = (T1)platform_get_drvdata(id)
(
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
2019-05-13 9:01 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:33 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:33 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---
> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
@ 2019-05-13 9:33 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:33 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---
> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
2019-05-13 9:01 ` [Cocci] " Markus Elfring
@ 2019-07-06 13:13 ` Masahiro Yamada
-1 siblings, 0 replies; 92+ messages in thread
From: Masahiro Yamada @ 2019-07-06 13:13 UTC (permalink / raw)
To: Markus Elfring
Cc: Julia Lawall, Gilles Muller, Michal Marek, Nicolas Palix,
Wen Yang, Yi Wang, cocci, Linux Kernel Mailing List
On Mon, May 13, 2019 at 6:02 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---
Applied to linux-kbuild.
> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment
@ 2019-07-06 13:13 ` Masahiro Yamada
0 siblings, 0 replies; 92+ messages in thread
From: Masahiro Yamada @ 2019-07-06 13:13 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, Linux Kernel Mailing List,
cocci, Wen Yang
On Mon, May 13, 2019 at 6:02 PM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 8 May 2019 13:50:49 +0200
>
> Extend a when constraint in a SmPL rule so that an additional cast
> is optionally excluded from source code searches for an expression
> in assignments.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Link: https://lore.kernel.org/lkml/alpine.DEB.2.21.1902160934400.3212@hadrien/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005592.html
> ---
Applied to linux-kbuild.
> scripts/coccinelle/free/put_device.cocci | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 3ebebc064f10..120921366e84 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -24,7 +24,7 @@ if (id == NULL || ...) { ... return ...; }
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> - when != e1 = &id->dev
> + when != e1 = (T)(&id->dev)
> when != e1 = get_device(&id->dev)
> when != e1 = (T1)platform_get_drvdata(id)
> (
> --
> 2.21.0
>
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
--
Best Regards
Masahiro Yamada
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* [PATCH 3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:05 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:05 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 12 May 2019 18:32:46 +0200
An assignment target was repeated in four SmPL when constraints.
Combine the exclusion specifications into disjunctions for the semantic
patch language so that this target is referenced only once there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 120921366e84..aae79c02c1e0 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
- when != e1 = (T)id
- when != e1 = (T)(&id->dev)
- when != e1 = get_device(&id->dev)
- when != e1 = (T1)platform_get_drvdata(id)
+ when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
(
return
( id
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 9:05 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:05 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 12 May 2019 18:32:46 +0200
An assignment target was repeated in four SmPL when constraints.
Combine the exclusion specifications into disjunctions for the semantic
patch language so that this target is referenced only once there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 120921366e84..aae79c02c1e0 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
- when != e1 = (T)id
- when != e1 = (T)(&id->dev)
- when != e1 = get_device(&id->dev)
- when != e1 = (T1)platform_get_drvdata(id)
+ when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
(
return
( id
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [PATCH 3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 9:05 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:32 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:32 UTC (permalink / raw)
To: Markus Elfring
Cc: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 12 May 2019 18:32:46 +0200
>
> An assignment target was repeated in four SmPL when constraints.
> Combine the exclusion specifications into disjunctions for the semantic
> patch language so that this target is referenced only once there.
NACK. This exceeds 80 characters and provides no readability benefit.
julia
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 120921366e84..aae79c02c1e0 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
> when != platform_device_put(id)
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> - when != e1 = (T)id
> - when != e1 = (T)(&id->dev)
> - when != e1 = get_device(&id->dev)
> - when != e1 = (T1)platform_get_drvdata(id)
> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
> (
> return
> ( id
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 9:32 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:32 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, cocci, Wen Yang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 12 May 2019 18:32:46 +0200
>
> An assignment target was repeated in four SmPL when constraints.
> Combine the exclusion specifications into disjunctions for the semantic
> patch language so that this target is referenced only once there.
NACK. This exceeds 80 characters and provides no readability benefit.
julia
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 120921366e84..aae79c02c1e0 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
> when != platform_device_put(id)
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> - when != e1 = (T)id
> - when != e1 = (T)(&id->dev)
> - when != e1 = get_device(&id->dev)
> - when != e1 = (T1)platform_get_drvdata(id)
> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
> (
> return
> ( id
> --
> 2.21.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 9:32 ` [Cocci] " Julia Lawall
@ 2019-05-13 11:48 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:48 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> An assignment target was repeated in four SmPL when constraints.
>> Combine the exclusion specifications into disjunctions for the semantic
>> patch language so that this target is referenced only once there.
>
> NACK.
I find this rejection questionable.
> This exceeds 80 characters
The line became 105 characters long.
14 space characters can eventually be omitted.
> and provides no readability benefit.
I try to stress SmPL functionality in this use case.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
>> when != platform_device_put(id)
>> when != of_dev_put(id)
>> when != if (id) { ... put_device(&id->dev) ... }
>> - when != e1 = (T)id
>> - when != e1 = (T)(&id->dev)
>> - when != e1 = get_device(&id->dev)
>> - when != e1 = (T1)platform_get_drvdata(id)
>> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
How do you think about to extend the Coccinelle software in the way
that such a detailed constraint can be specified on separate lines
(without duplicated SmPL code)?
How long will it take to reconsider corresponding software limitations?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 11:48 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:48 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> An assignment target was repeated in four SmPL when constraints.
>> Combine the exclusion specifications into disjunctions for the semantic
>> patch language so that this target is referenced only once there.
>
> NACK.
I find this rejection questionable.
> This exceeds 80 characters
The line became 105 characters long.
14 space characters can eventually be omitted.
> and provides no readability benefit.
I try to stress SmPL functionality in this use case.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
>> when != platform_device_put(id)
>> when != of_dev_put(id)
>> when != if (id) { ... put_device(&id->dev) ... }
>> - when != e1 = (T)id
>> - when != e1 = (T)(&id->dev)
>> - when != e1 = get_device(&id->dev)
>> - when != e1 = (T1)platform_get_drvdata(id)
>> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
How do you think about to extend the Coccinelle software in the way
that such a detailed constraint can be specified on separate lines
(without duplicated SmPL code)?
How long will it take to reconsider corresponding software limitations?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 9:32 ` [Cocci] " Julia Lawall
@ 2019-05-13 11:48 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:48 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> An assignment target was repeated in four SmPL when constraints.
>> Combine the exclusion specifications into disjunctions for the semantic
>> patch language so that this target is referenced only once there.
>
> NACK.
I find this rejection questionable.
> This exceeds 80 characters
The line became 105 characters long.
14 space characters can eventually be omitted.
> and provides no readability benefit.
I try to stress SmPL functionality in this use case.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
>> when != platform_device_put(id)
>> when != of_dev_put(id)
>> when != if (id) { ... put_device(&id->dev) ... }
>> - when != e1 = (T)id
>> - when != e1 = (T)(&id->dev)
>> - when != e1 = get_device(&id->dev)
>> - when != e1 = (T1)platform_get_drvdata(id)
>> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
How do you think about to extend the Coccinelle software in the way
that such a detailed constraint can be specified on separate lines
(without duplicated SmPL code)?
How long will it take to reconsider corresponding software limitations?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 11:48 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 11:48 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> An assignment target was repeated in four SmPL when constraints.
>> Combine the exclusion specifications into disjunctions for the semantic
>> patch language so that this target is referenced only once there.
>
> NACK.
I find this rejection questionable.
> This exceeds 80 characters
The line became 105 characters long.
14 space characters can eventually be omitted.
> and provides no readability benefit.
I try to stress SmPL functionality in this use case.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
>> when != platform_device_put(id)
>> when != of_dev_put(id)
>> when != if (id) { ... put_device(&id->dev) ... }
>> - when != e1 = (T)id
>> - when != e1 = (T)(&id->dev)
>> - when != e1 = get_device(&id->dev)
>> - when != e1 = (T1)platform_get_drvdata(id)
>> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
How do you think about to extend the Coccinelle software in the way
that such a detailed constraint can be specified on separate lines
(without duplicated SmPL code)?
How long will it take to reconsider corresponding software limitations?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 11:48 ` [Cocci] " Markus Elfring
@ 2019-05-13 11:51 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 11:51 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> >> An assignment target was repeated in four SmPL when constraints.
> >> Combine the exclusion specifications into disjunctions for the semantic
> >> patch language so that this target is referenced only once there.
> >
> > NACK.
>
> I find this rejection questionable.
>
>
> > This exceeds 80 characters
>
> The line became 105 characters long.
> 14 space characters can eventually be omitted.
>
>
> > and provides no readability benefit.
>
> I try to stress SmPL functionality in this use case.
That's not the goal of the semantic patches in the kernel.
The rule is fine as it is.
> >> +++ b/scripts/coccinelle/free/put_device.cocci
> >> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
> >> when != platform_device_put(id)
> >> when != of_dev_put(id)
> >> when != if (id) { ... put_device(&id->dev) ... }
> >> - when != e1 = (T)id
> >> - when != e1 = (T)(&id->dev)
> >> - when != e1 = get_device(&id->dev)
> >> - when != e1 = (T1)platform_get_drvdata(id)
> >> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
>
> How do you think about to extend the Coccinelle software in the way
> that such a detailed constraint can be specified on separate lines
> (without duplicated SmPL code)?
This causes some ambiguities in the parser. No change is likely to occur
here.
julia
>
> How long will it take to reconsider corresponding software limitations?
>
> Regards,
> Markus
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 11:51 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 11:51 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> >> An assignment target was repeated in four SmPL when constraints.
> >> Combine the exclusion specifications into disjunctions for the semantic
> >> patch language so that this target is referenced only once there.
> >
> > NACK.
>
> I find this rejection questionable.
>
>
> > This exceeds 80 characters
>
> The line became 105 characters long.
> 14 space characters can eventually be omitted.
>
>
> > and provides no readability benefit.
>
> I try to stress SmPL functionality in this use case.
That's not the goal of the semantic patches in the kernel.
The rule is fine as it is.
> >> +++ b/scripts/coccinelle/free/put_device.cocci
> >> @@ -23,10 +23,7 @@ if (id == NULL || ...) { ... return ...; }
> >> when != platform_device_put(id)
> >> when != of_dev_put(id)
> >> when != if (id) { ... put_device(&id->dev) ... }
> >> - when != e1 = (T)id
> >> - when != e1 = (T)(&id->dev)
> >> - when != e1 = get_device(&id->dev)
> >> - when != e1 = (T1)platform_get_drvdata(id)
> >> + when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
>
> How do you think about to extend the Coccinelle software in the way
> that such a detailed constraint can be specified on separate lines
> (without duplicated SmPL code)?
This causes some ambiguities in the parser. No change is likely to occur
here.
julia
>
> How long will it take to reconsider corresponding software limitations?
>
> Regards,
> Markus
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
2019-05-13 11:51 ` [Cocci] " Julia Lawall
@ 2019-05-13 12:52 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:52 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> I try to stress SmPL functionality in this use case.
>
> That's not the goal of the semantic patches in the kernel.
>
> The rule is fine as it is.
I am curious under which circumstances other software aspects
can become more relevant (as suggested).
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one
@ 2019-05-13 12:52 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:52 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> I try to stress SmPL functionality in this use case.
>
> That's not the goal of the semantic patches in the kernel.
>
> The rule is fine as it is.
I am curious under which circumstances other software aspects
can become more relevant (as suggested).
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:07 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:07 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:47:17 +0200
A SmPL ellipsis was specified for a search approach so that additional
source code would be tolerated between an assignment to a local variable
and the corresponding null pointer check.
But such code should be restricted.
* The local variable must not be reassigned there.
* It must also not be forwarded to an other assignment target.
Take additional casts for these code exclusion specifications into account
together with optional parentheses.
Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index aae79c02c1e0..28b0be53fb3f 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -13,13 +13,15 @@ virtual org
local idexpression id;
expression x,e,e1;
position p1,p2;
-type T,T1,T2,T3;
+type T,T1,T2,T3,T4,T5,T6;
@@
id = of_find_device_by_node@p1(x)
-... when != e = id
+ ... when != e = (T4)(id)
+ when != id = (T5)(e)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
+ when != id = (T6)(e)
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-13 9:07 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:07 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:47:17 +0200
A SmPL ellipsis was specified for a search approach so that additional
source code would be tolerated between an assignment to a local variable
and the corresponding null pointer check.
But such code should be restricted.
* The local variable must not be reassigned there.
* It must also not be forwarded to an other assignment target.
Take additional casts for these code exclusion specifications into account
together with optional parentheses.
Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index aae79c02c1e0..28b0be53fb3f 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -13,13 +13,15 @@ virtual org
local idexpression id;
expression x,e,e1;
position p1,p2;
-type T,T1,T2,T3;
+type T,T1,T2,T3,T4,T5,T6;
@@
id = of_find_device_by_node@p1(x)
-... when != e = id
+ ... when != e = (T4)(id)
+ when != id = (T5)(e)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
+ when != id = (T6)(e)
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-13 9:07 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:31 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:31 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 May 2019 09:47:17 +0200
>
> A SmPL ellipsis was specified for a search approach so that additional
> source code would be tolerated between an assignment to a local variable
> and the corresponding null pointer check.
>
> But such code should be restricted.
> * The local variable must not be reassigned there.
> * It must also not be forwarded to an other assignment target.
>
> Take additional casts for these code exclusion specifications into account
> together with optional parentheses.
NACK. You don't need so many type metavariables. Type metavariables in
the same ... can be the same.
julia
>
> Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
> Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index aae79c02c1e0..28b0be53fb3f 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -13,13 +13,15 @@ virtual org
> local idexpression id;
> expression x,e,e1;
> position p1,p2;
> -type T,T1,T2,T3;
> +type T,T1,T2,T3,T4,T5,T6;
> @@
>
> id = of_find_device_by_node@p1(x)
> -... when != e = id
> + ... when != e = (T4)(id)
> + when != id = (T5)(e)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> + when != id = (T6)(e)
> when != platform_device_put(id)
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-13 9:31 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:31 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 May 2019 09:47:17 +0200
>
> A SmPL ellipsis was specified for a search approach so that additional
> source code would be tolerated between an assignment to a local variable
> and the corresponding null pointer check.
>
> But such code should be restricted.
> * The local variable must not be reassigned there.
> * It must also not be forwarded to an other assignment target.
>
> Take additional casts for these code exclusion specifications into account
> together with optional parentheses.
NACK. You don't need so many type metavariables. Type metavariables in
the same ... can be the same.
julia
>
> Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
> Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
> Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> scripts/coccinelle/free/put_device.cocci | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index aae79c02c1e0..28b0be53fb3f 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -13,13 +13,15 @@ virtual org
> local idexpression id;
> expression x,e,e1;
> position p1,p2;
> -type T,T1,T2,T3;
> +type T,T1,T2,T3,T4,T5,T6;
> @@
>
> id = of_find_device_by_node@p1(x)
> -... when != e = id
> + ... when != e = (T4)(id)
> + when != id = (T5)(e)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> + when != id = (T6)(e)
> when != platform_device_put(id)
> when != of_dev_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> --
> 2.21.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-13 9:31 ` [Cocci] " Julia Lawall
@ 2019-05-13 12:22 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:22 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> Take additional casts for these code exclusion specifications into account
>> together with optional parentheses.
>
> NACK.
I find this rejection surprising.
> You don't need so many type metavariables.
I got an other software development opinion for this aspect.
Yesterday we started to clarify consequences from the isomorphism specification
“drop_cast” (for SmPL code).
https://github.com/coccinelle/coccinelle/blob/32d3b89ad909316464344a5f61a8092d8d702321/standard.iso#L52
Information like the following influenced my design decision to add three
metavariables here.
elfring@Sonne:~/Projekte/Linux/next-patched> spatch --parse-cocci scripts/coccinelle/free/put_device.cocci
…
warning: iso drop_cast does not match the code below on line -1
T (T )id
pure metavariable T is matched against the following nonpure code:
T
…
> Type metavariables in the same ... can be the same.
I would find it also occasionally nice when multiple SmPL ellipses
can refer to identical type casts.
* The under-documented “type purity” hinders this at the moment.
* But I got the impression that it can be safer to distinguish these
code variants better.
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-13 12:22 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:22 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> Take additional casts for these code exclusion specifications into account
>> together with optional parentheses.
>
> NACK.
I find this rejection surprising.
> You don't need so many type metavariables.
I got an other software development opinion for this aspect.
Yesterday we started to clarify consequences from the isomorphism specification
“drop_cast” (for SmPL code).
https://github.com/coccinelle/coccinelle/blob/32d3b89ad909316464344a5f61a8092d8d702321/standard.iso#L52
Information like the following influenced my design decision to add three
metavariables here.
elfring@Sonne:~/Projekte/Linux/next-patched> spatch --parse-cocci scripts/coccinelle/free/put_device.cocci
…
warning: iso drop_cast does not match the code below on line -1
T (T )id
pure metavariable T is matched against the following nonpure code:
T
…
> Type metavariables in the same ... can be the same.
I would find it also occasionally nice when multiple SmPL ellipses
can refer to identical type casts.
* The under-documented “type purity” hinders this at the moment.
* But I got the impression that it can be safer to distinguish these
code variants better.
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-13 9:31 ` [Cocci] " Julia Lawall
@ 2019-05-14 5:55 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 5:55 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> A SmPL ellipsis was specified for a search approach so that additional
>> source code would be tolerated between an assignment to a local variable
>> and the corresponding null pointer check.
>>
>> But such code should be restricted.
>> * The local variable must not be reassigned there.
>> * It must also not be forwarded to an other assignment target.
>>
>> Take additional casts for these code exclusion specifications into account
>> together with optional parentheses.
>
> NACK.
Can you agree to any information which I presented in the commit message?
> You don't need so many type metavariables.
It seems that the Coccinelle software can cope also with my SmPL code addition.
You might feel uncomfortable with the suggested changes for a while.
> Type metavariables in the same ... can be the same.
Such information is good to know for the proper usage of specifications
after a SmPL ellipsis.
* Can it become required to identify involved source code placeholders
by extra metavariables?
* Would you like to clarify the probability any more how often the shown
type casts will be identical?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-14 5:55 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 5:55 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> A SmPL ellipsis was specified for a search approach so that additional
>> source code would be tolerated between an assignment to a local variable
>> and the corresponding null pointer check.
>>
>> But such code should be restricted.
>> * The local variable must not be reassigned there.
>> * It must also not be forwarded to an other assignment target.
>>
>> Take additional casts for these code exclusion specifications into account
>> together with optional parentheses.
>
> NACK.
Can you agree to any information which I presented in the commit message?
> You don't need so many type metavariables.
It seems that the Coccinelle software can cope also with my SmPL code addition.
You might feel uncomfortable with the suggested changes for a while.
> Type metavariables in the same ... can be the same.
Such information is good to know for the proper usage of specifications
after a SmPL ellipsis.
* Can it become required to identify involved source code placeholders
by extra metavariables?
* Would you like to clarify the probability any more how often the shown
type casts will be identical?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-14 5:55 ` [Cocci] " Markus Elfring
@ 2019-05-14 6:52 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-14 6:52 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Tue, 14 May 2019, Markus Elfring wrote:
> >> A SmPL ellipsis was specified for a search approach so that additional
> >> source code would be tolerated between an assignment to a local variable
> >> and the corresponding null pointer check.
> >>
> >> But such code should be restricted.
> >> * The local variable must not be reassigned there.
> >> * It must also not be forwarded to an other assignment target.
> >>
> >> Take additional casts for these code exclusion specifications into account
> >> together with optional parentheses.
> >
> > NACK.
>
> Can you agree to any information which I presented in the commit message?
>
>
> > You don't need so many type metavariables.
>
> It seems that the Coccinelle software can cope also with my SmPL code addition.
> You might feel uncomfortable with the suggested changes for a while.
It's ugly. Much more ugly than msg =
>
>
> > Type metavariables in the same ... can be the same.
>
> Such information is good to know for the proper usage of specifications
> after a SmPL ellipsis.
>
> * Can it become required to identify involved source code placeholders
> by extra metavariables?
I don't understand the question.
> * Would you like to clarify the probability any more how often the shown
> type casts will be identical?
No idea about this one either.
Basically, if you have T && T, the two T's have to be the same, and T is
not pure. If you have T || T, then only one will be matched and T remains
pure. If you have T on two separate ...s then you are in the && case. If
you have T in two branches of a disjunction or in two whens on the same
... you are in the || case. Just as you can use the variable e1 over and
over on the same when, you can use the same T.
julia
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-14 6:52 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-14 6:52 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Tue, 14 May 2019, Markus Elfring wrote:
> >> A SmPL ellipsis was specified for a search approach so that additional
> >> source code would be tolerated between an assignment to a local variable
> >> and the corresponding null pointer check.
> >>
> >> But such code should be restricted.
> >> * The local variable must not be reassigned there.
> >> * It must also not be forwarded to an other assignment target.
> >>
> >> Take additional casts for these code exclusion specifications into account
> >> together with optional parentheses.
> >
> > NACK.
>
> Can you agree to any information which I presented in the commit message?
>
>
> > You don't need so many type metavariables.
>
> It seems that the Coccinelle software can cope also with my SmPL code addition.
> You might feel uncomfortable with the suggested changes for a while.
It's ugly. Much more ugly than msg =
>
>
> > Type metavariables in the same ... can be the same.
>
> Such information is good to know for the proper usage of specifications
> after a SmPL ellipsis.
>
> * Can it become required to identify involved source code placeholders
> by extra metavariables?
I don't understand the question.
> * Would you like to clarify the probability any more how often the shown
> type casts will be identical?
No idea about this one either.
Basically, if you have T && T, the two T's have to be the same, and T is
not pure. If you have T || T, then only one will be matched and T remains
pure. If you have T on two separate ...s then you are in the && case. If
you have T in two branches of a disjunction or in two whens on the same
... you are in the || case. Just as you can use the variable e1 over and
over on the same when, you can use the same T.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-14 6:52 ` [Cocci] " Julia Lawall
@ 2019-05-14 7:49 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 7:49 UTC (permalink / raw)
To: Julia Lawall, Wen Yang
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
cocci, linux-kernel, Yi Wang
>> Can you agree to any information which I presented in the commit message?
Do you find this description inappropriate?
>>> You don't need so many type metavariables.
>>
>> It seems that the Coccinelle software can cope also with my SmPL code addition.
>> You might feel uncomfortable with the suggested changes for a while.
>
> It's ugly. Much more ugly than msg =
The clarification of this change reluctance might become more interesting.
I got convinced that there is a need for further software updates.
>> * Can it become required to identify involved source code placeholders
>> by extra metavariables?
>
> I don't understand the question.
Wen Yang was planning a corresponding modification since 2019-02-19.
https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
I got into the development mood to contribute another concrete update suggestion
for an open issue in affected scripts for the semantic patch language.
Do you recognise the need for the extension of exclusion specifications here?
>> * Would you like to clarify the probability any more how often the shown
>> type casts will be identical?
>
> No idea about this one either.
I am curious if helpful ideas will be added also by other contributors.
> Basically, if you have T && T, the two T's have to be the same,
Such an expectation might be logical.
> and T is not pure.
This information triggers various communication difficulties.
> If you have T on two separate ...s then you are in the && case.
I agree to this view also according the application of two ellipses
in the SmPL rule “search”.
> If you have T in two branches of a disjunction or in two whens on the same
> ... you are in the || case.
It is clear that disjunctions will check code alternatives here.
The clarification of consequences around the interpretation of “type purity”
might distract from the final solution.
How many (optional) type casts would we like to handle by the discussed
source code search approach?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-14 7:49 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 7:49 UTC (permalink / raw)
To: Julia Lawall, Wen Yang
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, cocci
>> Can you agree to any information which I presented in the commit message?
Do you find this description inappropriate?
>>> You don't need so many type metavariables.
>>
>> It seems that the Coccinelle software can cope also with my SmPL code addition.
>> You might feel uncomfortable with the suggested changes for a while.
>
> It's ugly. Much more ugly than msg =
The clarification of this change reluctance might become more interesting.
I got convinced that there is a need for further software updates.
>> * Can it become required to identify involved source code placeholders
>> by extra metavariables?
>
> I don't understand the question.
Wen Yang was planning a corresponding modification since 2019-02-19.
https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
I got into the development mood to contribute another concrete update suggestion
for an open issue in affected scripts for the semantic patch language.
Do you recognise the need for the extension of exclusion specifications here?
>> * Would you like to clarify the probability any more how often the shown
>> type casts will be identical?
>
> No idea about this one either.
I am curious if helpful ideas will be added also by other contributors.
> Basically, if you have T && T, the two T's have to be the same,
Such an expectation might be logical.
> and T is not pure.
This information triggers various communication difficulties.
> If you have T on two separate ...s then you are in the && case.
I agree to this view also according the application of two ellipses
in the SmPL rule “search”.
> If you have T in two branches of a disjunction or in two whens on the same
> ... you are in the || case.
It is clear that disjunctions will check code alternatives here.
The clarification of consequences around the interpretation of “type purity”
might distract from the final solution.
How many (optional) type casts would we like to handle by the discussed
source code search approach?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses
2019-05-14 7:49 ` [Cocci] " Markus Elfring
(?)
@ 2019-05-14 9:18 ` wen.yang99
2019-05-14 9:51 ` [Cocci] " Markus Elfring
2019-05-15 17:09 ` [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses Markus Elfring
-1 siblings, 2 replies; 92+ messages in thread
From: wen.yang99 @ 2019-05-14 9:18 UTC (permalink / raw)
To: Markus.Elfring; +Cc: wang.yi59, michal.lkml, nicolas.palix, linux-kernel, cocci
[-- Attachment #1.1: Type: text/plain, Size: 1586 bytes --]
> Subject: Re: [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses
> >> Can you agree to any information which I presented in the commit message?
>
> Do you find this description inappropriate?
>
>
> >>> You don't need so many type metavariables.
> >>
> >> It seems that the Coccinelle software can cope also with my SmPL code addition.
> >> You might feel uncomfortable with the suggested changes for a while.
> >
> > It's ugly. Much more ugly than msg =
>
> The clarification of this change reluctance might become more interesting.
> I got convinced that there is a need for further software updates.
>
>
> >> * Can it become required to identify involved source code placeholders
> >> by extra metavariables?
> >
> > I don't understand the question.
>
> Wen Yang was planning a corresponding modification since 2019-02-19.
> https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
> https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
>
Hi Markus,
I did another experiment at that time and found that this modification will
reduce the false positive rate, but it may also reduce the recall rate.
Could we use it to find out as many bugs as possible in the current kernel
and then modify it?
https://systeme.lip6.fr/pipermail/cocci/2019-February/005626.html
Thanks.
--
Regards,
Wen
>
> I got into the development mood to contribute another concrete update suggestion
> for an open issue in affected scripts for the semantic patch language.
> Do you recognise the need for the extension of exclusion specifications here?
>
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses
2019-05-14 9:18 ` [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses wen.yang99
@ 2019-05-14 9:51 ` Markus Elfring
2019-05-15 17:09 ` [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses Markus Elfring
1 sibling, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 9:51 UTC (permalink / raw)
To: Wen Yang
Cc: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Yi Wang, LKML, Coccinelle
> I did another experiment at that time and found that this modification will
> reduce the false positive rate,
Thanks for such feedback.
Will my update suggestion influence the current (or future) software situation?
> but it may also reduce the recall rate.
Would you like to explain this information a bit more?
> Could we use it to find out as many bugs as possible in the current kernel
> and then modify it?
I hope so.
* Will the false positive rate influence change acceptance considerably?
* Would you like to work with source code analysis approaches based on
adjusted confidence settings?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses
@ 2019-05-14 9:51 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 9:51 UTC (permalink / raw)
To: Wen Yang; +Cc: Yi Wang, Michal Marek, Nicolas Palix, LKML, Coccinelle
> I did another experiment at that time and found that this modification will
> reduce the false positive rate,
Thanks for such feedback.
Will my update suggestion influence the current (or future) software situation?
> but it may also reduce the recall rate.
Would you like to explain this information a bit more?
> Could we use it to find out as many bugs as possible in the current kernel
> and then modify it?
I hope so.
* Will the false positive rate influence change acceptance considerably?
* Would you like to work with source code analysis approaches based on
adjusted confidence settings?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-14 9:18 ` [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses wen.yang99
2019-05-14 9:51 ` [Cocci] " Markus Elfring
@ 2019-05-15 17:09 ` Markus Elfring
1 sibling, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-15 17:09 UTC (permalink / raw)
To: Wen Yang
Cc: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Yi Wang, Coccinelle, LKML
> Could we use it to find out as many bugs as possible in the current kernel
How do you think about to work with any more source code analysis approaches?
> and then modify it?
I guess that you do not need to wait for a solution so long.
Variables which get reassigned in unwanted ways (before the desired call
of a resource release function in the discussed use case) can be found also
with the help of the semantic patch language (Coccinelle software).
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-14 6:52 ` [Cocci] " Julia Lawall
@ 2019-05-14 7:49 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 7:49 UTC (permalink / raw)
To: Julia Lawall, Wen Yang
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
cocci, linux-kernel, Yi Wang
>> Can you agree to any information which I presented in the commit message?
Do you find this description inappropriate?
>>> You don't need so many type metavariables.
>>
>> It seems that the Coccinelle software can cope also with my SmPL code addition.
>> You might feel uncomfortable with the suggested changes for a while.
>
> It's ugly. Much more ugly than msg =
The clarification of this change reluctance might become more interesting.
I got convinced that there is a need for further software updates.
>> * Can it become required to identify involved source code placeholders
>> by extra metavariables?
>
> I don't understand the question.
Wen Yang was planning a corresponding modification since 2019-02-19.
https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
I got into the development mood to contribute another concrete update suggestion
for an open issue in affected scripts for the semantic patch language.
Do you recognise the need for the extension of exclusion specifications here?
>> * Would you like to clarify the probability any more how often the shown
>> type casts will be identical?
>
> No idea about this one either.
I am curious if helpful ideas will be added also by other contributors.
> Basically, if you have T && T, the two T's have to be the same,
Such an expectation might be logical.
> and T is not pure.
This information triggers various communication difficulties.
> If you have T on two separate ...s then you are in the && case.
I agree to this view also according the application of two ellipses
in the SmPL rule “search”.
> If you have T in two branches of a disjunction or in two whens on the same
> ... you are in the || case.
It is clear that disjunctions will check code alternatives here.
The clarification of consequences around the interpretation of “type purity”
might distract from the final solution.
How many (optional) type casts would we like to handle by the discussed
source code search approach?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-14 7:49 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-14 7:49 UTC (permalink / raw)
To: Julia Lawall, Wen Yang
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, cocci
>> Can you agree to any information which I presented in the commit message?
Do you find this description inappropriate?
>>> You don't need so many type metavariables.
>>
>> It seems that the Coccinelle software can cope also with my SmPL code addition.
>> You might feel uncomfortable with the suggested changes for a while.
>
> It's ugly. Much more ugly than msg =
The clarification of this change reluctance might become more interesting.
I got convinced that there is a need for further software updates.
>> * Can it become required to identify involved source code placeholders
>> by extra metavariables?
>
> I don't understand the question.
Wen Yang was planning a corresponding modification since 2019-02-19.
https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
I got into the development mood to contribute another concrete update suggestion
for an open issue in affected scripts for the semantic patch language.
Do you recognise the need for the extension of exclusion specifications here?
>> * Would you like to clarify the probability any more how often the shown
>> type casts will be identical?
>
> No idea about this one either.
I am curious if helpful ideas will be added also by other contributors.
> Basically, if you have T && T, the two T's have to be the same,
Such an expectation might be logical.
> and T is not pure.
This information triggers various communication difficulties.
> If you have T on two separate ...s then you are in the && case.
I agree to this view also according the application of two ellipses
in the SmPL rule “search”.
> If you have T in two branches of a disjunction or in two whens on the same
> ... you are in the || case.
It is clear that disjunctions will check code alternatives here.
The clarification of consequences around the interpretation of “type purity”
might distract from the final solution.
How many (optional) type casts would we like to handle by the discussed
source code search approach?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:07 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:07 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:47:17 +0200
A SmPL ellipsis was specified for a search approach so that additional
source code would be tolerated between an assignment to a local variable
and the corresponding null pointer check.
But such code should be restricted.
* The local variable must not be reassigned there.
* It must also not be forwarded to an other assignment target.
Take additional casts for these code exclusion specifications into account
together with optional parentheses.
Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index aae79c02c1e0..28b0be53fb3f 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -13,13 +13,15 @@ virtual org
local idexpression id;
expression x,e,e1;
position p1,p2;
-type T,T1,T2,T3;
+type T,T1,T2,T3,T4,T5,T6;
@@
id = of_find_device_by_node@p1(x)
-... when != e = id
+ ... when != e = (T4)(id)
+ when != id = (T5)(e)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
+ when != id = (T6)(e)
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
@ 2019-05-13 9:07 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:07 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:47:17 +0200
A SmPL ellipsis was specified for a search approach so that additional
source code would be tolerated between an assignment to a local variable
and the corresponding null pointer check.
But such code should be restricted.
* The local variable must not be reassigned there.
* It must also not be forwarded to an other assignment target.
Take additional casts for these code exclusion specifications into account
together with optional parentheses.
Link: https://lore.kernel.org/cocci/201902191014156680299@zte.com.cn/
Link: https://systeme.lip6.fr/pipermail/cocci/2019-February/005620.html
Fixes: da9cfb87a44da61f2403c4312916befcb6b6d7e8 ("coccinelle: semantic code search for missing put_device()")
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index aae79c02c1e0..28b0be53fb3f 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -13,13 +13,15 @@ virtual org
local idexpression id;
expression x,e,e1;
position p1,p2;
-type T,T1,T2,T3;
+type T,T1,T2,T3,T4,T5,T6;
@@
id = of_find_device_by_node@p1(x)
-... when != e = id
+ ... when != e = (T4)(id)
+ when != id = (T5)(e)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
+ when != id = (T6)(e)
when != platform_device_put(id)
when != of_dev_put(id)
when != if (id) { ... put_device(&id->dev) ... }
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
2019-05-13 8:55 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:10 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:10 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: cocci, linux-kernel, Yi Wang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:55:22 +0200
A single parameter was repeated for a function call in two SmPL
when constraints.
Combine the exclusion specifications into a disjunction for the semantic
patch language so that this argument is referenced only once there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 28b0be53fb3f..975cabb97d01 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
when != id = (T6)(e)
- when != platform_device_put(id)
- when != of_dev_put(id)
+ when != \( platform_device_put \| of_dev_put \) (id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
(
--
2.21.0
^ permalink raw reply related [flat|nested] 92+ messages in thread
* [Cocci] [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
@ 2019-05-13 9:10 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 9:10 UTC (permalink / raw)
To: Julia Lawall, Gilles Muller, Masahiro Yamada, Michal Marek,
Nicolas Palix, Wen Yang
Cc: Yi Wang, cocci, linux-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 13 May 2019 09:55:22 +0200
A single parameter was repeated for a function call in two SmPL
when constraints.
Combine the exclusion specifications into a disjunction for the semantic
patch language so that this argument is referenced only once there.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/free/put_device.cocci | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
index 28b0be53fb3f..975cabb97d01 100644
--- a/scripts/coccinelle/free/put_device.cocci
+++ b/scripts/coccinelle/free/put_device.cocci
@@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
if (id == NULL || ...) { ... return ...; }
... when != put_device(&id->dev)
when != id = (T6)(e)
- when != platform_device_put(id)
- when != of_dev_put(id)
+ when != \( platform_device_put \| of_dev_put \) (id)
when != if (id) { ... put_device(&id->dev) ... }
when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
(
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 92+ messages in thread
* Re: [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
2019-05-13 9:10 ` [Cocci] " Markus Elfring
@ 2019-05-13 9:30 ` Julia Lawall
-1 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:30 UTC (permalink / raw)
To: Markus Elfring
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 May 2019 09:55:22 +0200
>
> A single parameter was repeated for a function call in two SmPL
> when constraints.
> Combine the exclusion specifications into a disjunction for the semantic
> patch language so that this argument is referenced only once there.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
NACK. This hurts readability and gives no practical benefit.
julia
> ---
> scripts/coccinelle/free/put_device.cocci | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 28b0be53fb3f..975cabb97d01 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> when != id = (T6)(e)
> - when != platform_device_put(id)
> - when != of_dev_put(id)
> + when != \( platform_device_put \| of_dev_put \) (id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
> (
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
@ 2019-05-13 9:30 ` Julia Lawall
0 siblings, 0 replies; 92+ messages in thread
From: Julia Lawall @ 2019-05-13 9:30 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
On Mon, 13 May 2019, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 May 2019 09:55:22 +0200
>
> A single parameter was repeated for a function call in two SmPL
> when constraints.
> Combine the exclusion specifications into a disjunction for the semantic
> patch language so that this argument is referenced only once there.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
NACK. This hurts readability and gives no practical benefit.
julia
> ---
> scripts/coccinelle/free/put_device.cocci | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci b/scripts/coccinelle/free/put_device.cocci
> index 28b0be53fb3f..975cabb97d01 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> when != id = (T6)(e)
> - when != platform_device_put(id)
> - when != of_dev_put(id)
> + when != \( platform_device_put \| of_dev_put \) (id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = \( (T) \( id \| (&id->dev) \) \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
> (
> --
> 2.21.0
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
2019-05-13 9:30 ` [Cocci] " Julia Lawall
@ 2019-05-13 12:35 ` Markus Elfring
-1 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:35 UTC (permalink / raw)
To: Julia Lawall
Cc: Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix,
Wen Yang, cocci, linux-kernel, Yi Wang
>> Combine the exclusion specifications into a disjunction for the semantic
>> patch language so that this argument is referenced only once there.
…
> NACK. This hurts readability
I suggest to reconsider such readability concerns once more.
Can corresponding software limitations be adjusted any further?
> and gives no practical benefit.
I guess that you know better which aspects can matter also here
for software fine-tuning.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
>> if (id == NULL || ...) { ... return ...; }
>> ... when != put_device(&id->dev)
>> when != id = (T6)(e)
>> - when != platform_device_put(id)
>> - when != of_dev_put(id)
>> + when != \( platform_device_put \| of_dev_put \) (id)
Can the reduction of a bit of duplicate SmPL code result in nicer
run time characteristics?
Regards,
Markus
^ permalink raw reply [flat|nested] 92+ messages in thread
* Re: [Cocci] [5/5] Coccinelle: put_device: Merge two SmPL when constraints into one
@ 2019-05-13 12:35 ` Markus Elfring
0 siblings, 0 replies; 92+ messages in thread
From: Markus Elfring @ 2019-05-13 12:35 UTC (permalink / raw)
To: Julia Lawall
Cc: Yi Wang, Michal Marek, Nicolas Palix, linux-kernel, Wen Yang, cocci
>> Combine the exclusion specifications into a disjunction for the semantic
>> patch language so that this argument is referenced only once there.
…
> NACK. This hurts readability
I suggest to reconsider such readability concerns once more.
Can corresponding software limitations be adjusted any further?
> and gives no practical benefit.
I guess that you know better which aspects can matter also here
for software fine-tuning.
>> +++ b/scripts/coccinelle/free/put_device.cocci
>> @@ -22,8 +22,7 @@ id = of_find_device_by_node@p1(x)
>> if (id == NULL || ...) { ... return ...; }
>> ... when != put_device(&id->dev)
>> when != id = (T6)(e)
>> - when != platform_device_put(id)
>> - when != of_dev_put(id)
>> + when != \( platform_device_put \| of_dev_put \) (id)
Can the reduction of a bit of duplicate SmPL code result in nicer
run time characteristics?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 92+ messages in thread