Skip to content

Commit 26c5637

Browse files
committed
tracing/histograms: Fix parsing of "sym-offset" modifier
With the addition of simple mathematical operations (plus and minus), the parsing of the "sym-offset" modifier broke, as it took the '-' part of the "sym-offset" as a minus, and tried to break it up into a mathematical operation of "field.sym - offset", in which case it failed to parse (unless the event had a field called "offset"). Both .sym and .sym-offset modifiers should not be entered into mathematical calculations anyway. If ".sym-offset" is found in the modifier, then simply make it not an operation that can be calculated on. Link: https://lkml.kernel.org/r/[email protected] Cc: Ingo Molnar <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Daniel Bristot de Oliveira <[email protected]> Cc: [email protected] Fixes: 100719d ("tracing: Add simple expression support to hist triggers") Reviewed-by: Tom Zanussi <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 4030a6e commit 26c5637

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,13 @@ static int contains_operator(char *str)
15551555

15561556
switch (*op) {
15571557
case '-':
1558+
/*
1559+
* Unfortunately, the modifier ".sym-offset"
1560+
* can confuse things.
1561+
*/
1562+
if (op - str >= 4 && !strncmp(op - 4, ".sym-offset", 11))
1563+
return FIELD_OP_NONE;
1564+
15581565
if (*str == '-')
15591566
field_op = FIELD_OP_UNARY_MINUS;
15601567
else

0 commit comments

Comments
 (0)