lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 8 Jul 2020 12:16:46 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Joe Perches <joe@...ches.com>
cc:     Shuah Khan <skhan@...uxfoundation.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Valentina Manea <valentina.manea.m@...il.com>,
        Shuah Khan <shuah@...nel.org>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usbip: Use fallthrough pseudo-keyword



On Tue, 7 Jul 2020, Joe Perches wrote:

> On Tue, 2020-07-07 at 14:06 -0600, Shuah Khan wrote:
> > On 7/7/20 1:52 PM, Gustavo A. R. Silva wrote:
> > > Replace the existing /* fall through */ comments and its variants with
> > > the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
> > > fall-through markings when it is the case.
> > >
> > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
> > >
> >
> > Is fallthrough syntax supported on our min gcc version?
>
> No.  Introduced in gcc 7.
>
> > Does checkpatch or coccicheck catch these cases?
>
> Kinda.  checkpatch isn't very good at it.
> I _believe_, though I'm not at all sure,
> that coccinelle can find these.

I would not guarantee anything about the support of Coccinelle for switch.
Coccinelle does now have the ability to match on comments.  So since there
is a distinct comment that it is to be removed, it might be possible to do
that part automatically.

Maybe it would have to look something like this:

@r1@
comments c : script:python() { code to recognize the comment };
statement S;
@@

S@c
+ fallthrough(); //or whatever is wanted

@@
statement r1.S;
@@

- S
- fallthrough();
+ S
+ fallthrough();

The second rule probably looks pretty strange, but the goal is to remove
the comments between S and fallthrough();

There is an example demos/comments.cocci that shows how to access the
comment information using both ocaml and python.

julia

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ