Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] Coccinelle: pci_free_consistent: Checking when constraints
@ 2019-09-08  8:10 Markus Elfring
  2019-09-08  8:23 ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2019-09-08  8:10 UTC (permalink / raw)
  To: Coccinelle, Gilles Muller, Julia Lawall, Masahiro Yamada,
	Michal Marek, Nicolas Palix, Petr Strnad, Wen Yang
  Cc: Kate Stewart, Yi Wang, Greg Kroah-Hartman, LKML, Thomas Gleixner,
	Allison Randal

Hello,

I have taken another look at a known script for the semantic patch language.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/pci_free_consistent.cocci?id=950b07c14e8c59444e2359f15fd70ed5112e11a0#n2

The following SmPL code is used there so far.

…
... when != pci_free_consistent(x,y,id,z)
    when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
    when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
…


It is specified that a specific function call should be excluded
in a source code search.
I do not see a need to repeat the specification twice that such a call
could eventually happen also within a branch of another if statement.
How do you think about to omit possibly redundant SmPL code at this place?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] Coccinelle: pci_free_consistent: Checking when constraints
  2019-09-08  8:10 [Cocci] Coccinelle: pci_free_consistent: Checking when constraints Markus Elfring
@ 2019-09-08  8:23 ` Julia Lawall
  2019-09-08 12:48   ` Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-09-08  8:23 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Kate Stewart, Yi Wang, Petr Strnad, Michal Marek,
	Greg Kroah-Hartman, Nicolas Palix, LKML, Wen Yang,
	Thomas Gleixner, Coccinelle, Allison Randal

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]



On Sun, 8 Sep 2019, Markus Elfring wrote:

> Hello,
>
> I have taken another look at a known script for the semantic patch language.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/pci_free_consistent.cocci?id=950b07c14e8c59444e2359f15fd70ed5112e11a0#n2
>
> The following SmPL code is used there so far.
>
> …
> ... when != pci_free_consistent(x,y,id,z)
>     when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
>     when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> …
>
>
> It is specified that a specific function call should be excluded
> in a source code search.
> I do not see a need to repeat the specification twice that such a call
> could eventually happen also within a branch of another if statement.
> How do you think about to omit possibly redundant SmPL code at this place?

Have you actually run the rule and checked the impact of your proposed
change?

The when exists below these lines has an impact.  I believe that the rule
is ok as is.  A single path may have no call to pci_free_consistent, but
if it has that call under one of the mentioned ifs, then the path is still
ok, and not something that an error should be reported about.

julia

[-- 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] 5+ messages in thread

* Re: [Cocci] Coccinelle: pci_free_consistent: Checking when constraints
  2019-09-08  8:23 ` Julia Lawall
@ 2019-09-08 12:48   ` Markus Elfring
       [not found]     ` <alpine.DEB.2.21.1909082149100.2644@hadrien>
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2019-09-08 12:48 UTC (permalink / raw)
  To: Julia Lawall, Coccinelle
  Cc: Kate Stewart, Yi Wang, Petr Strnad, Michal Marek,
	Greg Kroah-Hartman, Nicolas Palix, LKML, Thomas Gleixner,
	Wen Yang, Allison Randal

> The when exists below these lines has an impact.

This parameter should result in a desirable effect.


> I believe that the rule is ok as is.

I wonder about the relevance of the shown double if statement exclusion.


> A single path may have no call to pci_free_consistent,

We come along different views around the provided software functionality
once more.


> but if it has that call under one of the mentioned ifs,
> then the path is still ok,

I find that this information can need further clarification.


> and not something that an error should be reported about.

I do not expect an error message from the SmPL script execution here.

I just try again to clarify if the specification of a single function call
exclusion can (and should) be sufficient also at this place.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] Coccinelle: pci_free_consistent: Checking when constraints
       [not found]     ` <alpine.DEB.2.21.1909082149100.2644@hadrien>
@ 2019-09-09 10:40       ` Markus Elfring
  2019-09-16  6:24       ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-09-09 10:40 UTC (permalink / raw)
  To: Julia Lawall, Coccinelle
  Cc: Kate Stewart, Yi Wang, Michal Marek, Greg Kroah-Hartman,
	Nicolas Palix, LKML, Thomas Gleixner, Wen Yang, Allison Randal

>> I just try again to clarify if the specification of a single function call
>> exclusion can (and should) be sufficient also at this place.
>
> It's not sufficient.
>
> I explained why it's not sufficient.

Thanks for another bit of information.


> If you had made your change and tested it, it's at least highly probable
> that you would understand why it is not sufficient as well.
>
> You first reflex when you have a question should be to try what you are
> wondering about, not to head for the mailing list.

I got the impression that a few of our previous clarification attempts
pointed design possibilities out into other directions.

Examples:
* Coccinelle: semantic patch for missing of_node_put
  Response by Wen Yang
  17 May 2019 14:32:57 +0800 (CST)
  https://lore.kernel.org/r/201905171432571474636@zte.com.cn/

  https://lore.kernel.org/r/141163ed-a78b-6d89-e6cd-3442adda7073@web.de/
  https://systeme.lip6.fr/pipermail/cocci/2019-May/005809.html
  https://lkml.org/lkml/2019/5/9/99

* [v5] Coccinelle: semantic code search for missing put_device()
  Discussion contribution by Markus Elfring
  https://lore.kernel.org/r/b2f195e8-c3a3-f876-a075-317bb33496c6@web.de/
  https://systeme.lip6.fr/pipermail/cocci/2019-February/005578.html
  https://lkml.org/lkml/2019/2/15/412


> Please stop spreading misinformation.

I find the provided software documentation still incomplete.
Thus I hope also that the situation can be improved by additional communication.

See also:
  [v5] Coccinelle: semantic code search for missing put_device()
  Response by Julia Lawall
  16 Feb 2019 10:36:45 +0100 (CET)
  alpine.DEB.2.21.1902161036120.3212@hadrien

  https://lore.kernel.org/r/6c114d10-0d17-6f43-4c33-0f57c230306f@web.de/
  https://systeme.lip6.fr/pipermail/cocci/2019-February/005594.html
  https://lkml.org/lkml/2019/2/16/38


How will the software development attention evolve further around the safe handling
of code exclusion specifications together with the semantic patch language?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] Coccinelle: pci_free_consistent: Checking when constraints
       [not found]     ` <alpine.DEB.2.21.1909082149100.2644@hadrien>
  2019-09-09 10:40       ` Markus Elfring
@ 2019-09-16  6:24       ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-09-16  6:24 UTC (permalink / raw)
  To: Julia Lawall, Coccinelle
  Cc: Kate Stewart, Yi Wang, Michal Marek, Greg Kroah-Hartman,
	Nicolas Palix, LKML, Thomas Gleixner, Wen Yang, Allison Randal

> If you had made your change and tested it, it's at least highly probable
> that you would understand why it is not sufficient as well.

Where do you expect to find the information how the Coccinelle software
should handle SmPL when constraints here finally?


> You first reflex when you have a question should be to try what you are
> wondering about, not to head for the mailing list.
>
> Please stop spreading misinformation.

* How will different application views influence the desired clarification of
  software behaviour also for this use case?

* Can such an open issue be resolved better?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-08  8:10 [Cocci] Coccinelle: pci_free_consistent: Checking when constraints Markus Elfring
2019-09-08  8:23 ` Julia Lawall
2019-09-08 12:48   ` Markus Elfring
     [not found]     ` <alpine.DEB.2.21.1909082149100.2644@hadrien>
2019-09-09 10:40       ` Markus Elfring
2019-09-16  6:24       ` Markus Elfring

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git