cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Checking statement order for patch generation with SmPL support
Date: Thu, 7 Sep 2017 20:10:45 +0200	[thread overview]
Message-ID: <a99dbaa2-8bfd-7ee1-0122-9b99d4d9fdda@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.20.1709071619340.3168@hadrien>

> Thers is a control-flow path from the bottom of a loop back up to the top.

I wonder also about the information how an ordinary for loop could influence
the shown source code analysis result for the function ?snd_seq_queue_find_name?
when the questionable marked statements are contained in a single if branch.
http://elixir.free-electrons.com/linux/v4.13/source/sound/core/seq/seq_queue.c#L241
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/sound/core/seq/seq_queue.c?id=c6be5a0e3cebc145127d46a58350e05d2bcf6323#n252


I have tried the following SmPL script variant out on another source file.

@usage@
identifier action!~"^.+free$", member, release=~"^.+free$";
expression context, ex;
@@
*release(context);
 ... when != context = ex
     when any
*action(..., (context)->member, ...)


elfring at Sonne:~/Projekte/Linux/next-patched> spatch.opt ~/Projekte/Coccinelle/janitor/show_use_after_free3.cocci sound/soc/soc-pcm.c
?
@@ -1199,14 +1199,11 @@ void dpcm_be_disconnect(struct snd_soc_p
 			stream ? "<-" : "->", dpcm->be->dai_link->name);
 
 		/* BEs still alive need new FE */
-		dpcm_be_reparent(fe, dpcm->be, stream);
 
 #ifdef CONFIG_DEBUG_FS
-		debugfs_remove(dpcm->debugfs_state);
 #endif
 		list_del(&dpcm->list_be);
 		list_del(&dpcm->list_fe);
-		kfree(dpcm);
 	}
 }


I find the shown matches also questionable for this test result.
Would you like to clarify such software situations a bit more
for the desired handling of statement sequences?

Regards,
Markus

  parent reply	other threads:[~2017-09-07 18:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 13:10 [Cocci] Checking statement order for patch generation with SmPL support SF Markus Elfring
2017-09-07 13:21 ` Julia Lawall
2017-09-07 13:51   ` SF Markus Elfring
2017-09-07 14:21     ` Julia Lawall
2017-09-07 14:36       ` SF Markus Elfring
2017-09-07 18:10       ` SF Markus Elfring [this message]
2017-09-07 21:26         ` Julia Lawall
2017-09-08  6:58           ` SF Markus Elfring
2017-09-08  7:15             ` Julia Lawall

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=a99dbaa2-8bfd-7ee1-0122-9b99d4d9fdda@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).