Skip to content

Commit 68f93cb

Browse files
tracing/histogram: Fix check for missing operands in an expression
JIRA: https://issues.redhat.com/browse/RHEL-67679 commit 1cab6bc Author: Kalesh Singh <[email protected]> Date: Fri Nov 12 11:13:24 2021 -0800 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]> Signed-off-by: Tomas Glozar <[email protected]>
1 parent 4b2cb46 commit 68f93cb

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
@@ -2489,7 +2489,8 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
24892489
operand1_str = str;
24902490
str = sep+1;
24912491

2492-
if (!operand1_str || !str)
2492+
/* Binary operator requires both operands */
2493+
if (*operand1_str == '\0' || *str == '\0')
24932494
goto free;
24942495

24952496
operand_flags = 0;

0 commit comments

Comments
 (0)