tracing/histogram: Fix check for missing operands in an expression
PATCH 1/1 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.
Signed-off-by Kalesh Singh <[email protected]>
Fixes 9710b2f341a0 ("tracing: Fix operator precedence for hist triggers expression")
Reported-by Dan Carpenter <[email protected]>
--- kernel/trace/trace_events_hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace_events_hist.c +2 -1
@@ -2580,7 +2580,8 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data, operand1_str = str; str = sep+1 ; -if (!operand1_str || !str) +/* Binary operator requires both operands */ +if (*operand1_str =='\0' || *str =='\0' ) goto free; operand_flags =0 ;
base-commit: 5833291ab6de9c3e2374336b51c814e515e8f3a5
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog