All of lore.kernel.org
 help / color / mirror / Atom feed
* Coccinelle: understanding its output
@ 2021-04-19 17:45 Fabio M. De Francesco
  2021-04-19 18:58 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio M. De Francesco @ 2021-04-19 17:45 UTC (permalink / raw)
  To: outreachy-kernel

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?

 I'd appreciate some help.

Thanks,

Fabio
 




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-20 17:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.