[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20131118213131.57232871@gandalf.local.home>
Date: Mon, 18 Nov 2013 21:31:31 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
Frederic Weisbecker <fweisbec@...il.com>
Subject: Re: tools lib traceevent: Report better error message on bad
function args
On Tue, 19 Nov 2013 11:23:56 +0900
Namhyung Kim <namhyung@...nel.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists