From: Julia Lawall <julia.lawall@lip6.fr>
To: wen.yang99@zte.com.cn
Cc: Markus.Elfring@web.de, Gilles Muller <Gilles.Muller@lip6.fr>,
nicolas.palix@imag.fr, michal.lkml@markovi.net,
wang.yi59@zte.com.cn, yamada.masahiro@socionext.com,
yellowriver2010@hotmail.com, cheng.shengyu@zte.com.cn,
cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [v5] Coccinelle: semantic code search for missing put_device()
Date: Sat, 16 Feb 2019 09:09:14 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.21.1902160908150.3212@hadrien> (raw)
In-Reply-To: <201902161529041506841@zte.com.cn>
[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]
On Sat, 16 Feb 2019, wen.yang99@zte.com.cn wrote:
> >>> Does the first SmPL when specification include the case that a call
> >>> of the function “put_device” can occur within a branch of an if statement?
> >>
> >> It does include that,
> >
> >Thanks for this acknowledgement.
> >
> >So it seems that you find my interpretation of this bit of SmPL code appropriate.
> >
> >> but there is another execution path where the put device is not present.
> >
> >It is tried to find such cases.
> >
> >> But given the test in the if in the when code,
> >> on that execution path id is NULL, an so there is no need to put it.
> >
> >I would like to point out that the function “put_device” belongs also to
> >the category of functions which tolerate the passing of null pointers.
> >https://elixir.bootlin.com/linux/v5.0-rc6/source/drivers/base/core.c#L2053
> >https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/core.c?id=cb5b020a8d38f77209d0472a0fea755299a8ec78#n2053
> >
> >Have we got still different software development opinions about the need
> >for an extra pointer check in the “second” SmPL when specification?
>
> Thanks to Julia and Markus.
> We will modify the the if in the when code like this:
>
> @@ -22,7 +22,7 @@ if (id == NULL || ...) { ... return ...; }
> ... when != put_device(&id->dev)
> when != platform_device_put(id)
> when != of_dev_put(id)
> - when != if (id) { ... put_device(&id->dev) ... }
> + when != if (...) { ... put_device(&id->dev) ... }
This looks ok. You can check the old version and the new version and see
if there is any differencein the set of reports.
julia
next parent reply other threads:[~2019-02-16 8:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201902161529041506841@zte.com.cn>
2019-02-16 8:09 ` Julia Lawall [this message]
2019-02-16 8:29 ` [v5] Coccinelle: semantic code search for missing put_device() Markus Elfring
2019-02-16 8:32 ` Julia Lawall
2019-02-16 8:44 ` Markus Elfring
2019-02-15 7:55 [PATCH v5] coccinelle: " Wen Yang
2019-02-15 12:52 ` [PATCH v5] Coccinelle: " Markus Elfring
2019-02-15 13:02 ` Julia Lawall
2019-02-15 13:15 ` [v5] " Markus Elfring
2019-02-15 13:15 ` Markus Elfring
2019-02-15 13:24 ` Julia Lawall
2019-02-15 13:54 ` Markus Elfring
2019-03-17 3:54 ` [PATCH v5] coccinelle: " Masahiro Yamada
2019-03-17 9:05 ` [v5] " Markus Elfring
2019-03-23 16:17 ` Markus Elfring
2019-03-26 6:54 ` Masahiro Yamada
2019-03-26 7:19 ` Julia Lawall
2019-03-26 9:14 ` Markus Elfring
2019-03-26 9:04 ` Markus Elfring
2019-03-26 9:52 ` Masahiro Yamada
2019-03-26 9:58 ` 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=alpine.DEB.2.21.1902160908150.3212@hadrien \
--to=julia.lawall@lip6.fr \
--cc=Gilles.Muller@lip6.fr \
--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=wang.yi59@zte.com.cn \
--cc=wen.yang99@zte.com.cn \
--cc=yamada.masahiro@socionext.com \
--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
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).