linux-kernel.vger.kernel.org archive mirror
 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>,
	cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org,
	Yi Wang <wang.yi59@zte.com.cn>
Subject: Re: [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses
Date: Mon, 13 May 2019 11:31:42 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1905131130530.3616@hadrien> (raw)
In-Reply-To: <6f08d4d7-5ffc-11c0-8200-cade7d294de6@web.de>



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
>
>

  reply	other threads:[~2019-05-13  9:31 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-23  6:14 [PATCH] coccinelle: put_device: reduce false positives Wen Yang
2019-03-23 13:41 ` Julia Lawall
2019-03-23 19:44 ` Markus Elfring
2019-03-23 20:06   ` Julia Lawall
2019-03-26  8:45     ` Dan Carpenter
2019-03-26  9:38       ` Julia Lawall
2019-03-26 10:11         ` Dan Carpenter
2019-03-26 10:15           ` Julia Lawall
2019-03-28 13:08             ` Masahiro Yamada
2019-03-28 14:19               ` Julia Lawall
2019-04-01  6:44               ` Coccinelle: " Markus Elfring
2019-04-01 20:04                 ` Julia Lawall
2019-05-13  8:55 ` [PATCH 0/5] Coccinelle: put_device: Adjustments for a SmPL script Markus Elfring
2019-05-13  8:59   ` [PATCH 1/5] Coccinelle: put_device: Adjust a message construction Markus Elfring
2019-05-13  9:35     ` Julia Lawall
2019-05-13 11:33       ` [1/5] " Markus Elfring
2019-05-13 11:36         ` Julia Lawall
2019-05-13 12:48           ` Markus Elfring
2019-07-06 13:13     ` [Cocci] [PATCH 1/5] " Masahiro Yamada
2019-05-13  9:01   ` [PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment Markus Elfring
2019-05-13  9:33     ` Julia Lawall
2019-07-06 13:13     ` [Cocci] " Masahiro Yamada
2019-05-13  9:05   ` [PATCH 3/5] Coccinelle: put_device: Merge four SmPL when constraints into one Markus Elfring
2019-05-13  9:32     ` Julia Lawall
2019-05-13 11:48       ` [3/5] " Markus Elfring
2019-05-13 11:48       ` Markus Elfring
2019-05-13 11:51         ` Julia Lawall
2019-05-13 12:52           ` Markus Elfring
2019-05-13  9:07   ` [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses Markus Elfring
2019-05-13  9:31     ` Julia Lawall [this message]
2019-05-13 12:22       ` [4/5] " Markus Elfring
2019-05-14  5:55       ` Markus Elfring
2019-05-14  6:52         ` Julia Lawall
2019-05-14  7:49           ` Markus Elfring
2019-05-14  7:49           ` Markus Elfring
2019-05-13  9:07   ` [PATCH 4/5] " Markus Elfring
2019-05-13  9:10   ` [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one Markus Elfring
2019-05-13  9:30     ` Julia Lawall
2019-05-13 12:35       ` [5/5] " Markus Elfring

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.20.1905131130530.3616@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;
as well as URLs for NNTP newsgroup(s).