[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZkX0XMrRGceOL8W-@gallifrey>
Date: Thu, 16 May 2024 11:56:12 +0000
From: "Dr. David Alan Gilbert" <linux@...blig.org>
To: Kees Cook <keescook@...omium.org>
Cc: linux-kernel@...r.kernel.org, nathan@...nel.org,
luc.vanoostenryck@...il.com
Subject: Re: thoughts wanted on dead code hunting?
* Kees Cook (keescook@...omium.org) wrote:
> On Thu, May 16, 2024 at 12:40:40AM +0000, Dr. David Alan Gilbert wrote:
> > * Kees Cook (keescook@...omium.org) wrote:
> > > // Options: --recursive-includes
> > > @find@
> > > struct to_be_removed INSTANCE;
> > > struct to_be_removed *POINTER;
>
> Oops, I missed this line:
>
> @@
>
> > >
> > > (
> > > * INSTANCE
> > > |
> > > * POINTER
> > > )
> > >
> > >
> > > (I bet this could be improved, but it should be a usable example.)
> >
> > Hmm, now if I could use coccinelle it would be more tolerant of coding
> > style and slight variations than my script.
> > However, trying that tiny example, I get:
> > File "play.cocci", line 10, column 1, charpos = 141
> > around = '',
> > whole content = )
> >
> > so it seems to be objecting to something at the end of the file?
>
> Sorry, yes, missed the "@@" between the identifiers and the code pattern
> to match.
Ah right, that's done it - I'd noticed there wasn't a @@ but couldn't
figure out where to put them.
After a bit of guessing, I also added a
virtual context
at the top and now:
make coccicheck COCCI=play.cocci M=arch/x86 MODE=context
works - thanks! I'll have a play.
Dave
> --
> Kees Cook
>
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ dave @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
Powered by blists - more mailing lists