git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tracing/filter: Do not WARN on operand count going below zero
[pandora-kernel.git]
/
kernel
/
trace
/
trace_events_filter.c
diff --git
a/kernel/trace/trace_events_filter.c
b/kernel/trace/trace_events_filter.c
index
ced69da
..
2900d77
100644
(file)
--- a/
kernel/trace/trace_events_filter.c
+++ b/
kernel/trace/trace_events_filter.c
@@
-1369,19
+1369,28
@@
static int check_preds(struct filter_parse_state *ps)
{
int n_normal_preds = 0, n_logical_preds = 0;
struct postfix_elt *elt;
{
int n_normal_preds = 0, n_logical_preds = 0;
struct postfix_elt *elt;
+ int cnt = 0;
list_for_each_entry(elt, &ps->postfix, list) {
list_for_each_entry(elt, &ps->postfix, list) {
- if (elt->op == OP_NONE)
+ if (elt->op == OP_NONE) {
+ cnt++;
continue;
continue;
+ }
if (elt->op == OP_AND || elt->op == OP_OR) {
n_logical_preds++;
if (elt->op == OP_AND || elt->op == OP_OR) {
n_logical_preds++;
+ cnt--;
continue;
}
continue;
}
+ if (elt->op != OP_NOT)
+ cnt--;
n_normal_preds++;
n_normal_preds++;
+ /* all ops should have operands */
+ if (cnt < 0)
+ break;
}
}
- if (!n_normal_preds || n_logical_preds >= n_normal_preds) {
+ if (
cnt != 1 ||
!n_normal_preds || n_logical_preds >= n_normal_preds) {
parse_error(ps, FILT_ERR_INVALID_FILTER, 0);
return -EINVAL;
}
parse_error(ps, FILT_ERR_INVALID_FILTER, 0);
return -EINVAL;
}