Skip to content

Commit

Permalink
tracing/filter: Have no filter return a match
Browse files Browse the repository at this point in the history
The n_preds field of a file can change at anytime, and even can become
zero, just as the filter is about to be processed by an event.
In the case that is zero on entering the filter, return 1, telling
the caller the event matchs and should be trace.

Also use a variable and assign it with ACCESS_ONCE() such that the
count stays consistent within the function.

Cc: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Feb 8, 2011
1 parent 075de90 commit 6d54057
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/trace/trace_events_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,14 @@ int filter_match_preds(struct event_filter *filter, void *rec)
int match, top = 0, val1 = 0, val2 = 0;
int stack[MAX_FILTER_PRED];
struct filter_pred *pred;
int n_preds = ACCESS_ONCE(filter->n_preds);
int i;

for (i = 0; i < filter->n_preds; i++) {
/* no filter is considered a match */
if (!n_preds)
return 1;

for (i = 0; i < n_preds; i++) {
pred = filter->preds[i];
if (!pred->pop_n) {
match = pred->fn(pred, rec, val1, val2);
Expand Down

0 comments on commit 6d54057

Please sign in to comment.