]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
tracing/filter: Have no filter return a match
authorSteven Rostedt <srostedt@redhat.com>
Fri, 28 Jan 2011 03:33:26 +0000 (22:33 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 8 Feb 2011 01:56:17 +0000 (20:56 -0500)
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>
kernel/trace/trace_events_filter.c

index 36d40104b17f6d53cdc89b45841cff2679551c56..7275f0310ed87a70013902727045b5a7199bd044 100644 (file)
@@ -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);