From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: outreachy-kernel <outreachy-kernel@googlegroups.com>
Subject: Re: [Outreachy kernel] Coccinelle: understanding its output
Date: Tue, 20 Apr 2021 19:03:20 +0200 [thread overview]
Message-ID: <7603910.ML0yFvfjEs@linux.local> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104201837130.176476@hadrien>
On Tuesday, April 20, 2021 6:37:35 PM CEST Julia Lawall wrote:
> On Tue, 20 Apr 2021, Fabio M. De Francesco wrote:
> > On Monday, April 19, 2021 8:58:24 PM CEST Julia Lawall wrote:
> > > On Mon, 19 Apr 2021, Fabio M. De Francesco wrote:
> > > > I think that I don't yet understand Coccinelle's output.
> > > >
> > > > I've just run the following command:
> > > > spatch --sp-file scripts/coccinelle/free/kfree.cocci --dir drivers/
> >
> > staging/
> >
> > > > wlan-ng/prism2fw.c
> > > >
> > > > It outputs something that looks like a patch:
> > > >
> > > > HANDLING: drivers/staging/wlan-ng/prism2fw.c
> > > >
> > > > (ONCE) already tagged but only removed, so safe
> > > >
> > > > diff =
> > > > --- drivers/staging/wlan-ng/prism2fw.c
> > > > +++ /tmp/cocci-output-17844-0c6c7c-prism2fw.c
> > > >
> > > > First, what is /tmp/cocci-output-17844-0c6c7c-prism2fwc? It is not a
> > > > file
> >
> > in
> >
> > > > / tmp. If it is a file, where is it?
> > > >
> > > > The output goes on with lines like the following ones:
> > > > @@ -1008,8 +1005,6 @@ static int writeimage(struct wlandevice
> > > >
> > > > rstmsg = kzalloc(sizeof(*rstmsg), GFP_KERNEL);
> > > > rwrmsg = kzalloc(sizeof(*rwrmsg), GFP_KERNEL);
> > > > if (!rstmsg || !rwrmsg) {
> > > >
> > > > - kfree(rstmsg);
> > > > - kfree(rwrmsg);
> > > >
> > > > netdev_err(wlandev->netdev,
> > > >
> > > > "%s: no memory for firmware download,
> > > > aborting
> > > >
> > > > download\n",
> > > >
> > > > __func__);
> > > >
> > > > Please read the two lines with a trailing '-'... Does Coccinelle mean
> > > > that
> > > > they should be removed? If yes, I'm not able to understand why,
because
> > > > I
> > > > think they must not be removed. Am I wrong?
> > >
> > > Sorry. I think that the *s are a left over from a version of the
semantic
> > > patch that was trying to do more. The semantic patches in the Linux
> > > kernel are meant to be used with make coccicheck, which would have
avoided
> > > this problem. The key is the lines
> >
> > "make coccicheck" fails with the following message:
> >
> > Python error: No module named coccilib.elems
> > coccicheck failed
> > make: *** [Makefile:1937: coccicheck] Error 255
> >
> > > virtual org
> > > virtual report
> > >
> > > near the top of the file. This means that the semantic patch should
only
> > > be run with either the option -D org (producing emacs org mode) or the
> > > option -D report (producing text). Both of these modes suppress the -
> > > that you are seeing.
> >
> > Run of "spatch -D report --sp-file
> > scripts/coccinelle/api/kfree_mismatch.cocci --dir drivers/staging/" fails
> > too:
> >
> > init_defs_builtins: /usr/bin/../lib/coccinelle/standard.h
> > Python error: No module named coccilib.elems
> >
> > I think that it depends on some package I have not yet installed, or to
some
> > environment variable that must be set for the Python interpreter to find
the
> > coccili.elems module... I really don't know.
> >
> > Do you have any idea for solving this problem?
>
> How did you install Coccinelle?
>
> julia
>
My laptop runs openSuSE Tumbleweed. Therefore I installed Coccinelle with a
simple "zypper install coccinelle". I see that it is (properly?) installed and
that also coccigrep has been installed, even though I didn't ask explicitly
for it.
Perhaps it would be better to reinstall Coccinelle from sources. I read on a
Vaishali Thakkar series of slides that they are clonable from github.com/
coccinelle/coccinelle. I hope that I also find there some documentation that
guides me to installing prerequisites and configure the tool for integrating
with Tumbleweed environment.
Is it a good solution?
Thanks,
Fabio
prev parent reply other threads:[~2021-04-20 17:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 17:45 Coccinelle: understanding its output Fabio M. De Francesco
2021-04-19 18:58 ` [Outreachy kernel] " Julia Lawall
2021-04-20 15:59 ` Fabio M. De Francesco
2021-04-20 16:37 ` Julia Lawall
2021-04-20 17:03 ` Fabio M. De Francesco [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=7603910.ML0yFvfjEs@linux.local \
--to=fmdefrancesco@gmail.com \
--cc=julia.lawall@inria.fr \
--cc=outreachy-kernel@googlegroups.com \
/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.