From: Ingo Molnar <mingo@elte.hu>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Tom Zanussi <tzanussi@gmail.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 4/4] tracing: add per-subsystem filtering
Date: Sun, 22 Mar 2009 20:50:33 +0100 [thread overview]
Message-ID: <20090322195033.GA15002@elte.hu> (raw)
In-Reply-To: <20090322190158.GF6002@nowhere>
* Frederic Weisbecker <fweisbec@gmail.com> wrote:
> > +int filter_add_subsystem_pred(struct event_subsystem *system,
> > + struct filter_pred *pred)
> > +{
> > + struct ftrace_event_call *call = __start_ftrace_events;
> > + struct filter_pred *event_pred;
> > + int i;
> > +
> > + if (system->preds && !pred->compound)
> > + filter_free_subsystem_preds(system);
> > +
> > + if (!system->preds) {
> > + system->preds = kzalloc(MAX_FILTER_PRED * sizeof(pred),
> > + GFP_KERNEL);
> > + if (!system->preds)
> > + return -ENOMEM;
> > + }
> > +
> > + for (i = 0; i < MAX_FILTER_PRED; i++) {
> > + if (!system->preds[i]) {
> > + system->preds[i] = pred;
> > + break;
> > + }
> > + if (i == MAX_FILTER_PRED - 1)
> > + return -EINVAL;
>
>
> Shouldn't it be i == MAX_FILTER_PRED ?
Here we search for a free slot in the array of sub-expressions of
the subsystem level filters. That condition cannot even be true
inside a 'i < MAX_FILTER_PRED' loop.
Checking for i==MAX would be fine if done outside of the loop - and
should probably be done that way. But the code is correct this way
too i think.
Ingo
next prev parent reply other threads:[~2009-03-22 19:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-22 8:31 [PATCH 4/4] tracing: add per-subsystem filtering Tom Zanussi
2009-03-22 19:01 ` Frederic Weisbecker
2009-03-22 19:50 ` Ingo Molnar [this message]
2009-03-22 19:54 ` Frederic Weisbecker
2009-03-22 19:40 ` [tip:tracing/filters] " Tom Zanussi
2009-03-23 18:24 ` [PATCH 4/4] " Steven Rostedt
2009-03-24 7:19 ` Tom Zanussi
2009-03-24 16:29 ` Steven Rostedt
2009-03-25 5:26 ` Tom Zanussi
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=20090322195033.GA15002@elte.hu \
--to=mingo@elte.hu \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/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.