From: Julia Lawall <julia.lawall@lip6.fr>
To: Joe Perches <joe@perches.com>
Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
Kalle Valo <kvalo@qca.qualcomm.com>,
netdev <netdev@vger.kernel.org>,
ath10k@lists.infradead.org
Subject: Re: [PATCH net-next] net:drivers/net: Miscellaneous conversions to ETH_ALEN
Date: Thu, 3 Oct 2013 00:38:06 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1310030034030.2162@localhost6.localdomain6> (raw)
In-Reply-To: <1380736969.2081.72.camel@joe-AO722>
On Wed, 2 Oct 2013, Joe Perches wrote:
> On Wed, 2013-10-02 at 10:44 -0700, Luis R. Rodriguez wrote:
> > On Tue, Oct 1, 2013 at 11:40 PM, Joe Perches <joe@perches.com> wrote:
> > > Please include netdev. (cc'd)
> > >
> > >> Joe Perches <joe@perches.com> writes:
> > >>
> > >> > Convert the memset/memcpy uses of 6 to ETH_ALEN
> > >> > where appropriate.
> > >
> > >> > Signed-off-by: Joe Perches <joe@perches.com>
> >
> > I think these sorts of patches are good -- but once applied it'd be
> > good if we can get the SmPL grammar expressed for it and then have
> > developers / maintainers regularly doing:
> >
> > make coccicheck MODE=patch M=path > path-cocci.patch
> >
> > Unfortunately right now MODE=patch takes about 3 1/2 minutes for
> > ath9k, MODE=org takes ~10 minutes for ath9k (17 minutes for all of
> > ath/), and MODE=context takes ~8 minutes on ath9k -- I do believe its
> > a bit unreasonable to expect patch submitters to use this, but
> > certainly great practice. Some of the time differences on the reports
> > can be explained by the fact that some SmPL will only be used for some
> > modes.
> >
> > Even though it takes a while right now it'd be great practice to use
> > coccicheck to prevent these type of changes from going in again,
> > things that checkpatch.pl won't be able to catch.
>
> As far as I can tell, it's basically not possible for cocci to
> do this conversion.
I tried looking for memcpys and memsets that do use ETH_ALEN and then
seeing what non-local functions the affected values flow to. I then
marked all of the calls to memcpy and memset that use 6 where an affected
value flows to one of the functions identified in the first pass. I get
40 unique results on Linux 3.10.
The semantic patch is below. It needs to be cleaned up to not return
duplicate results. It needs to be run with the argument --no-show-diff,
and the result is printed in emacs org mode.
julia
virtual after_start
@initialize:ocaml@
let neighbors = ref []
let local_functions = ref []
let reset = ref false
let do_reset _ =
if not !reset
then
begin
reset := true;
let it = new iteration() in
it#add_virtual_rule After_start;
it#register()
end
@script:ocaml depends on !after_start@
@@
local_functions := []
@locl@
identifier f;
@@
f(...) { ... }
@script:ocaml@
f << locl.f;
@@
local_functions := f :: !local_functions
@r depends on !after_start@
identifier f;
expression e,e1,e2;
@@
(
memcpy(e,e1,ETH_ALEN)
|
memcpy(e1,e,ETH_ALEN)
|
memset(e,e1,ETH_ALEN)
)
... when any
when != e = e2
f(...,e,...)
@script:ocaml@
f << r.f;
@@
if not (List.mem f !local_functions) && not (List.mem f !neighbors)
then begin neighbors := f :: !neighbors; do_reset() end
@r1 depends on !after_start@
identifier f;
expression e,e1,e2;
@@
f(...,e,...)
... when any
when != e = e2
(
memcpy(e,e1,6)
|
memcpy(e1,e,6)
|
memset(e,e1,6)
)
@script:ocaml@
f << r1.f;
@@
if not (List.mem f !local_functions) && not (List.mem f !neighbors)
then begin neighbors := f :: !neighbors; do_reset() end
// --------------------------------------------------------------------------
@s depends on after_start@
identifier f;
expression e,e1,e2;
position p;
@@
(
memcpy@p(e,e1,6)
|
memcpy@p(e1,e,6)
|
memset@p(e,e1,6)
)
... when any
when != e = e2
f(...,e,...)
@script:ocaml@
f << s.f;
p << s.p;
@@
if List.mem f !neighbors
then Coccilib.print_main "" p
@s1 depends on after_start@
identifier f;
expression e,e1,e2;
position p;
@@
f(...,e,...)
... when any
when != e = e2
(
memcpy@p(e,e1,6)
|
memcpy@p(e1,e,6)
|
memset@p(e,e1,6)
)
@script:ocaml@
f << s1.f;
p << s1.p;
@@
if List.mem f !neighbors
then Coccilib.print_main "" p
next prev parent reply other threads:[~2013-10-02 22:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 2:04 [PATCH net-next] net:drivers/net: Miscellaneous conversions to ETH_ALEN Joe Perches
[not found] ` <87k3hw469z.fsf@kamboji.qca.qualcomm.com>
2013-10-02 6:40 ` Joe Perches
2013-10-02 17:44 ` Luis R. Rodriguez
2013-10-02 18:02 ` Joe Perches
2013-10-02 22:38 ` Julia Lawall [this message]
2013-10-03 0:09 ` Joe Perches
2013-10-03 0:28 ` Joe Perches
2013-10-03 3:31 ` Joe Perches
2013-10-03 3:39 ` [PATCH net-next] ath10k: wmi: Convert use of 6 " Joe Perches
2013-10-03 3:44 ` David Miller
2013-10-03 4:18 ` Eric Dumazet
2013-10-03 4:34 ` Kalle Valo
2013-10-03 4:44 ` Eric Dumazet
2013-10-03 4:54 ` Kalle Valo
2013-10-03 5:09 ` Joe Perches
2013-10-03 5:24 ` Eric Dumazet
2013-10-03 5:34 ` Joe Perches
2013-10-03 5:47 ` Julia Lawall
2013-10-03 6:00 ` Eric Dumazet
2013-10-03 6:07 ` Joe Perches
2013-10-03 6:32 ` Julia Lawall
2013-10-03 4:56 ` Joe Perches
2013-10-03 5:43 ` Julia Lawall
2013-10-03 5:41 ` [PATCH net-next] net:drivers/net: Miscellaneous conversions " Julia Lawall
2013-10-02 7:27 ` Arend van Spriel
2013-10-02 21:05 ` David Miller
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.02.1310030034030.2162@localhost6.localdomain6 \
--to=julia.lawall@lip6.fr \
--cc=ath10k@lists.infradead.org \
--cc=joe@perches.com \
--cc=kvalo@qca.qualcomm.com \
--cc=mcgrof@do-not-panic.com \
--cc=netdev@vger.kernel.org \
/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