Commit 5e4904cb authored by Li Zefan's avatar Li Zefan Committed by Steven Rostedt

tracing/filters: operand can be negative

This should be a bug:

 # cat format
 name: foo_bar
 ID: 71
 format:
	 ...
         field:int bar;  offset:24;      size:4;
 # echo 'bar < 0' > filter
 # echo 'bar < -1' > filter
 bash: echo: write error: Invalid argument

[ Impact: fix to allow negative operand in filer expr ]
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A35B8DF.60400@cn.fujitsu.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent e4f2d10f
...@@ -546,6 +546,7 @@ static int filter_add_pred(struct filter_parse_state *ps, ...@@ -546,6 +546,7 @@ static int filter_add_pred(struct filter_parse_state *ps,
filter_pred_fn_t fn; filter_pred_fn_t fn;
unsigned long long val; unsigned long long val;
int string_type; int string_type;
int ret;
pred->fn = filter_pred_none; pred->fn = filter_pred_none;
...@@ -581,7 +582,11 @@ static int filter_add_pred(struct filter_parse_state *ps, ...@@ -581,7 +582,11 @@ static int filter_add_pred(struct filter_parse_state *ps,
pred->not = 1; pred->not = 1;
return filter_add_pred_fn(ps, call, pred, fn); return filter_add_pred_fn(ps, call, pred, fn);
} else { } else {
if (strict_strtoull(pred->str_val, 0, &val)) { if (field->is_signed)
ret = strict_strtoll(pred->str_val, 0, &val);
else
ret = strict_strtoull(pred->str_val, 0, &val);
if (ret) {
parse_error(ps, FILT_ERR_ILLEGAL_INTVAL, 0); parse_error(ps, FILT_ERR_ILLEGAL_INTVAL, 0);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment