All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <linux@treblig.org>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, nathan@kernel.org,
	luc.vanoostenryck@gmail.com
Subject: Re: thoughts wanted on dead code hunting?
Date: Thu, 16 May 2024 11:56:12 +0000	[thread overview]
Message-ID: <ZkX0XMrRGceOL8W-@gallifrey> (raw)
In-Reply-To: <202405152023.67ED1BD7@keescook>

* Kees Cook (keescook@chromium.org) wrote:
> On Thu, May 16, 2024 at 12:40:40AM +0000, Dr. David Alan Gilbert wrote:
> > * Kees Cook (keescook@chromium.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   |_______/

      reply	other threads:[~2024-05-16 11:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 12:08 thoughts wanted on dead code hunting? Dr. David Alan Gilbert
2024-05-15  0:14 ` Kees Cook
2024-05-16  0:40   ` Dr. David Alan Gilbert
2024-05-16  3:24     ` Kees Cook
2024-05-16 11:56       ` Dr. David Alan Gilbert [this message]

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=ZkX0XMrRGceOL8W-@gallifrey \
    --to=linux@treblig.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=nathan@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.