提交 1cab6bce 编写于 作者: K Kalesh Singh 提交者: Steven Rostedt (VMware)

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/20211112191324.1302505-1-kaleshsingh@google.comSigned-off-by: NKalesh Singh <kaleshsingh@google.com>
Fixes: 9710b2f3 ("tracing: Fix operator precedence for hist triggers expression")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 63f84ae6
......@@ -2581,7 +2581,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册