All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Finding missing return value checks for some function calls with SmPL
Date: Fri, 2 Dec 2016 11:00:20 +0100	[thread overview]
Message-ID: <99797688-d8b2-5001-dd92-26f98e3a4901@users.sourceforge.net> (raw)

Hello,

I would like to try another search pattern out with the semantic patch language
from the software ?Coccinelle 1.0.6-00022-g862f5b29 (OCaml 4.03)?.


SmPL script example:

@find_too_late_checking@
expression ex1, ex2;
identifier action1 =~ "^(?x)
(?:
   kzalloc
|  kmalloc_array
)$",
           action2 =~ "^(?x)
(?:
   kzalloc
|  kmalloc_array
)$",
           work;
type return_type;
@@
 return_type work(...)
 {
 ... when any
*ex1 = action1(...);
 ex2 = action2(...);
 ... when any
 }


Source code example:

static void __init cpg_mstp_clocks_init(struct device_node *np)
{
	struct mstp_clock_group *group;
	const char *idxname;
	struct clk **clks;
	unsigned int i;

	group = kzalloc(sizeof(*group), GFP_KERNEL);
	clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL);
	if (group == NULL || clks == NULL) {
		kfree(group);
		kfree(clks);
		pr_err("%s: failed to allocate group\n", __func__);
		return;
	}
}


elfring at Sonne:~/Projekte/Coccinelle/janitor> spatch.opt show_too_late_checking2.cocci ../Probe/clk-mstp-excerpt1.c
init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
HANDLING: ../Probe/clk-mstp-excerpt1.c


Now I wonder why the first assignment is not marked together with the function call
for further considerations by my source code analysis approach so far.
I would appreciate your advices.

Regards,
Markus

             reply	other threads:[~2016-12-02 10:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 10:00 SF Markus Elfring [this message]
2016-12-02 10:20 ` [Cocci] Finding missing return value checks for some function calls with SmPL SF Markus Elfring
2016-12-02 10:44   ` Julia Lawall
2016-12-02 11:55     ` SF Markus Elfring
     [not found]       ` <alpine.DEB.2.10.1612021324520.3056@hadrien>
2016-12-02 13:10         ` SF Markus Elfring
2016-12-02 13:38 ` [Cocci] Comparing SmPL script constraints with direct regular expression interface SF Markus Elfring
2016-12-02 13:42   ` Julia Lawall
2016-12-02 13:54     ` SF Markus Elfring
     [not found]       ` <alpine.DEB.2.10.1612021456580.3056@hadrien>
2016-12-02 14:20         ` SF Markus Elfring
     [not found]           ` <alpine.DEB.2.10.1612021526560.3056@hadrien>
2016-12-02 15:06             ` SF Markus Elfring
2016-12-02 20:48             ` SF Markus Elfring
2016-12-07 11:19               ` Michael Stefaniuc
2016-12-03 10:01 [Cocci] Excluding specific assignment combinations with SmPL SF Markus Elfring
2016-12-03 13:14 ` Julia Lawall
2016-12-03 17:43   ` SF Markus Elfring
2016-12-03 17:46     ` Julia Lawall
2016-12-03 17:58       ` SF Markus Elfring
2016-12-03 18:01         ` Julia Lawall
2016-12-06 10:15           ` [Cocci] Finding missing return value checks for some function calls " SF Markus Elfring

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=99797688-d8b2-5001-dd92-26f98e3a4901@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 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.