From: Steven Rostedt <rostedt@goodmis.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: Re: tools lib traceevent: Report better error message on bad function args
Date: Mon, 18 Nov 2013 21:31:31 -0500 [thread overview]
Message-ID: <20131118213131.57232871@gandalf.local.home> (raw)
In-Reply-To: <87siutt9hf.fsf@sejong.aot.lge.com>
On Tue, 19 Nov 2013 11:23:56 +0900
Namhyung Kim <namhyung@kernel.org> wrote:
> > arg->type = PRINT_FUNC;
> > @@ -2708,15 +2707,19 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
> > }
> >
> > type = process_arg(event, farg, &token);
> > - if (i < (func->nr_args - 1))
> > - test = ",";
> > - else
> > - test = ")";
> > -
> > - if (test_type_token(type, token, EVENT_DELIM, test)) {
> > - free_arg(farg);
> > - free_token(token);
> > - return EVENT_ERROR;
> > + if (i < (func->nr_args - 1)) {
> > + if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
> > + warning("Error: function '%s()' expects %d arguments but event %s only uses %d",
> > + func->name, func->nr_args,
> > + event->name, i + 1);
> > + return EVENT_ERROR;
> > + }
> > + } else {
> > + if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
> > + warning("Error: function '%s()' only expects %d arguments but event %s has more",
> > + func->name, func->nr_args, event->name);
> > + return EVENT_ERROR;
>
> It seems that you missed to free farg and token in error paths.
>
Ug, you're right!
Thanks for the review. v2 coming up.
-- Steve
prev parent reply other threads:[~2013-11-19 2:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 0:11 Steven Rostedt
2013-11-19 2:23 ` Namhyung Kim
2013-11-19 2:31 ` Steven Rostedt [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=20131118213131.57232871@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=acme@ghostprotocols.net \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®