From: Julia Lawall <julia.lawall@inria.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Denis Efremov <efremov@linux.com>,
Coccinelle <cocci@systeme.lip6.fr>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Gilles Muller <Gilles.Muller@lip6.fr>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Julia Lawall <julia.lawall@inria.fr>,
Kees Cook <keescook@chromium.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
Nicolas Palix <nicolas.palix@imag.fr>
Subject: Re: [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions
Date: Wed, 2 Sep 2020 09:24:00 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2009020921500.2528@hadrien> (raw)
In-Reply-To: <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de>
[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]
On Wed, 2 Sep 2020, Markus Elfring wrote:
> …
> > +++ b/scripts/coccinelle/free/ifnullfree.cocci
> > @@ -20,8 +20,14 @@ expression E;
> > - if (E != NULL)
> > (
> > kfree(E);
> > +|
> > + kvfree(E);
> > |
> > kfree_sensitive(E);
> > +|
> > + kvfree_sensitive(E, ...);
> > +|
> > + vfree(E);
> > |
> > debugfs_remove(E);
> > |
>
> Would you ever get into the development mood to move the source code search
> specification “(E);” out of the SmPL disjunction (as it happened for the rule “r”)?
>
>
> > @@ -42,9 +48,10 @@ position p;
> > @@
> >
> > * if (E != NULL)
> > -* \(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
> > +* \(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\|
> > +* debugfs_remove@p\|debugfs_remove_recursive@p\|
> > * usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
> > -* dma_pool_destroy@p\)(E);
> > +* dma_pool_destroy@p\)(E, ...);
> …
>
> How do you think about to attach the position variable to the opening parenthesis
> instead of each function name?
>
> +* dma_pool_destroy\)(@p E, ...);
While it probably impacts few people, this is a really bad idea for org
mode, because org mode colors the thing that the position variable is
attached to. Having the ( colored would not be very visible.
But even for report mode, this is probably not a good idea for the rare
case where the function name and the argument list are on different lines.
julia
>
>
> Would the number of function call parameters influence such SmPL code any more?
>
> Regards,
> Markus
>
next parent reply other threads:[~2020-09-02 7:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de>
2020-09-02 7:24 ` Julia Lawall [this message]
2020-09-02 4:40 Denis Efremov
2020-09-02 6:51 ` 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.22.394.2009020921500.2528@hadrien \
--to=julia.lawall@inria.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=Markus.Elfring@web.de \
--cc=cocci@systeme.lip6.fr \
--cc=efremov@linux.com \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nicolas.palix@imag.fr \
/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®