From: <wen.yang99@zte.com.cn>
To: <Markus.Elfring@web.de>
Cc: kernel-janitors@vger.kernel.org, michal.lkml@markovi.net,
yellowriver2010@hotmail.com, nicolas.palix@imag.fr,
linux-kernel@vger.kernel.org, cheng.shengyu@zte.com.cn,
cocci@systeme.lip6.fr
Subject: Re: [Cocci] [v6] coccinelle: semantic code search for missing put_device()
Date: Tue, 19 Feb 2019 17:09:34 +0800 (CST)
Message-ID: <201902191709341581016@zte.com.cn> (raw)
In-Reply-To: <31a0ea02-4005-23a4-8030-47319504e84a@web.de>
[-- Attachment #1.1: Type: text/plain, Size: 1973 bytes --]
> > Do you have any other questions?
>
> Obviously, yes.
> I am curious if this development discussion and code review will trigger
> further software adjustments.
> I guess that you will need additional time to reconsider specific items
> from recent feedback.
>
> Will corrections become relevant for specifications in (assignment) exclusions
> of the second SmPL ellipsis in the discussed script?
Let's do some experiments with the code in the current kernel.
Let us take this code as an example:
Https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/sound/soc/fsl/imx-sgtl5000.c
1, Original code
static int imx_sgtl5000_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device_node *ssi_np, *codec_np;
struct platform_device *ssi_pdev;
...
ssi_pdev = of_find_device_by_node(ssi_np);
...
}
Our current patch will find the problem:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function.
./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function.
The problem can be detected by both of the following methods:
+id = of_find_device_by_node@p1(x)
+... when != e = id
...
Or:
...
+ ... when != id = e
2, Suppose we change it to:
static int imx_sgtl5000_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device_node *ssi_np, *codec_np;
struct platform_device *ssi_pdev;
...
ssi_pdev = of_find_device_by_node(ssi_np);
...
ssi_pdev = to_platform_device(XYZ);
}
But this time, only the first method can detect the problem.
The second method, although the false positive rate is lower,
but the recall rate is reduced, we may miss some real issues.
Thanks,
Regards,
Wen
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply index
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-16 16:05 [Cocci] [PATCH v6] " Wen Yang
2019-02-16 16:33 ` Julia Lawall
2019-02-16 18:39 ` [Cocci] [v6] " Markus Elfring
2019-02-17 2:32 ` [Cocci] 答复: " Wen Yang
2019-02-17 7:42 ` Markus Elfring
2019-02-17 9:50 ` [Cocci] [PATCH v6] " Markus Elfring
2019-02-17 11:37 ` Julia Lawall
2019-02-17 11:42 ` Markus Elfring
2019-02-17 11:48 ` Julia Lawall
2019-02-17 12:00 ` [Cocci] [v6] " Markus Elfring
2019-02-17 12:05 ` Julia Lawall
2019-02-17 12:20 ` Markus Elfring
2019-02-17 12:52 ` Julia Lawall
2019-02-17 13:14 ` Markus Elfring
2019-02-18 3:22 ` wen.yang99
2019-02-18 6:43 ` Julia Lawall
2019-02-18 8:19 ` Markus Elfring
2019-02-19 2:14 ` wen.yang99
2019-02-19 7:04 ` Julia Lawall
2019-02-19 8:12 ` Markus Elfring
2019-02-19 8:29 ` Markus Elfring
2019-02-19 9:09 ` wen.yang99 [this message]
2019-02-19 9:30 ` Markus Elfring
2019-03-06 11:18 ` Markus Elfring
2019-02-18 21:40 ` 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=201902191709341581016@zte.com.cn \
--to=wen.yang99@zte.com.cn \
--cc=Markus.Elfring@web.de \
--cc=cheng.shengyu@zte.com.cn \
--cc=cocci@systeme.lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
--cc=yellowriver2010@hotmail.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
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