Skip to content

Commit 1cab6bc

Browse files
Kalesh Singhrostedt
authored andcommitted
tracing/histogram: Fix check for missing operands in an expression
If a binary operation is detected while parsing an expression string, the operand strings are deduced by splitting the experssion string at the position of the detected binary operator. Both operand strings are sub-strings (can be empty string) of the expression string but will never be NULL. Currently a NULL check is used for missing operands, fix this by checking for empty strings instead. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Kalesh Singh <[email protected]> Fixes: 9710b2f ("tracing: Fix operator precedence for hist triggers expression") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 63f84ae commit 1cab6bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/trace/trace_events_hist.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,8 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
25812581
operand1_str = str;
25822582
str = sep+1;
25832583

2584-
if (!operand1_str || !str)
2584+
/* Binary operator requires both operands */
2585+
if (*operand1_str == '\0' || *str == '\0')
25852586
goto free;
25862587

25872588
operand_flags = 0;

0 commit comments

Comments
 (0)