From: Julia Lawall <julia.lawall@inria.fr>
To: Deepak R Varma <drv@mailo.com>
Cc: nicolas palix <nicolas.palix@imag.fr>, cocci <cocci@inria.fr>,
linux-kernel <linux-kernel@vger.kernel.org>,
Saurabh Singh Sengar <ssengar@microsoft.com>,
Praveen Kumar <kumarpraveen@linux.microsoft.com>
Subject: Re: [PATCH] coccinelle: put_device: Include of_node_put to avoid false positives
Date: Sat, 25 Feb 2023 20:17:01 +0100 (CET) [thread overview]
Message-ID: <597798313.18813704.1677352621708.JavaMail.zimbra@inria.fr> (raw)
In-Reply-To: <Y+/DQ6l0pDcxC2c3@ubun2204.myguest.virtualbox.org>
> The node reference increased by of_find_device_by_node() can also be
> released by using a call to of_node_put(). Hence when this exists, the
> script should not trigger a warning, which otherwise will be a false
> positive.
Could you explain more about why of_node_put is sufficient?
thanks,
julia
> Also, improve the warning message to include of_node_put too is missing.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> scripts/coccinelle/free/put_device.cocci | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/coccinelle/free/put_device.cocci
> b/scripts/coccinelle/free/put_device.cocci
> index f09f1e79bfa6..259195b501aa 100644
> --- a/scripts/coccinelle/free/put_device.cocci
> +++ b/scripts/coccinelle/free/put_device.cocci
> @@ -18,8 +18,10 @@ type T,T1,T2,T3;
>
> id = of_find_device_by_node@p1(x)
> ... when != e = id
> + when != of_node_put(x)
> if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> + when != of_node_put(x)
> when != platform_device_put(id)
> when != if (id) { ... put_device(&id->dev) ... }
> when != e1 = (T)id
> @@ -42,7 +44,7 @@ p2 << search.p2;
> @@
>
> coccilib.report.print_report(p2[0],
> - "ERROR: missing put_device; call
> of_find_device_by_node on line "
> + "ERROR: missing put_device or of_node_put; call
> of_find_device_by_node on line "
> + p1[0].line
> + ", but without a corresponding object release within this function.")
>
> --
> 2.34.1
next prev parent reply other threads:[~2023-02-25 19:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 18:11 Deepak R Varma
2023-02-25 19:17 ` Julia Lawall [this message]
2023-02-26 20:22 ` Deepak R Varma
2023-02-26 20:33 ` Julia Lawall
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=597798313.18813704.1677352621708.JavaMail.zimbra@inria.fr \
--to=julia.lawall@inria.fr \
--cc=cocci@inria.fr \
--cc=drv@mailo.com \
--cc=kumarpraveen@linux.microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.palix@imag.fr \
--cc=ssengar@microsoft.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
Powered by JetHome