mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Wen Yang <wen.yang99@zte.com.cn>,
	Coccinelle <cocci@systeme.lip6.fr>,
	LKML <linux-kernel@vger.kernel.org>,
	Yi Wang <wang.yi59@zte.com.cn>
Subject: Re: [PATCH 3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses
Date: Tue, 14 May 2019 21:50:52 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1905142150360.2612@hadrien> (raw)
In-Reply-To: <c4e9153c-234e-ab5a-0061-221374c2505b@web.de>



On Tue, 14 May 2019, Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 14 May 2019 18:12:15 +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.

I leave this up to the ZTE people.

julia


>
> Fixes: f7b167113753e95ae61383e234f8d10142782ace ("scripts: Coccinelle script for pci_free_consistent()")
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  scripts/coccinelle/free/pci_free_consistent.cocci | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/pci_free_consistent.cocci
> index 45bc14ece151..48a36adfa3ce 100644
> --- a/scripts/coccinelle/free/pci_free_consistent.cocci
> +++ b/scripts/coccinelle/free/pci_free_consistent.cocci
> @@ -13,13 +13,15 @@ virtual org
>  local idexpression id;
>  expression x,y,z,e;
>  position p1,p2;
> -type T;
> +type T,T2,T3,T4;
>  @@
>
>  id = pci_alloc_consistent@p1(x,y,&z)
> -... when != e = id
> + ... when != id = (T2)(e)
> +     when != e = (T3)(id)
>  if (id == NULL || ...) { ... return ...; }
>  ... when != pci_free_consistent(x,y,id,z)
> +    when != id = (T4)(e)
>      when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
>      when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
>      when != e = (T)id
> --
> 2.21.0
>
>

      reply	other threads:[~2019-05-14 19:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 16:44 [PATCH 0/3] Coccinelle: pci_free_consistent: Adjustments for a SmPL script Markus Elfring
2019-05-14 16:48 ` [PATCH 1/3] Coccinelle: pci_free_consistent: Use formatted strings directly in SmPL rules Markus Elfring
2019-05-14 19:50   ` Julia Lawall
2019-05-15  5:27     ` [1/3] " Markus Elfring
2019-05-15  6:10       ` Julia Lawall
2019-05-14 16:50 ` [PATCH 2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code Markus Elfring
2019-05-14 19:47   ` Julia Lawall
2019-05-15  5:35     ` [2/3] " Markus Elfring
2019-05-15  6:11       ` Julia Lawall
2019-05-15  6:11       ` Julia Lawall
2019-05-15  7:02         ` Markus Elfring
     [not found]           ` <alpine.DEB.2.21.1905150908550.2591@hadrien>
2019-05-15  7:33             ` Coccinelle: Handling of SmPL disjunctions Markus Elfring
     [not found]               ` <alpine.DEB.2.20.1905151120370.3231@hadrien>
2019-05-15  9:55                 ` Markus Elfring
2019-07-09  9:52                   ` Markus Elfring
2019-05-14 16:50 ` [PATCH 2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code Markus Elfring
2019-05-14 16:52 ` [PATCH 3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses Markus Elfring
2019-05-14 19:50   ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1905142150360.2612@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=wang.yi59@zte.com.cn \
    --cc=wen.yang99@zte.com.cn \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®