提交 ead1a574 编写于 作者: C Colin Ian King 提交者: Arnaldo Carvalho de Melo

perf probe: Check if *ptr2 is zero and not ptr2

Static anaylsis with cppcheck[1] detected an incorrect comparison:
[tools/perf/util/probe-event.c:216]: (warning) Char literal compared
with pointer 'ptr2'. Did you intend to dereference it?

Dereference ptr2 for the comparison to fix this.

1: https://sourceforge.net/p/cppcheck/wiki/Home/Signed-off-by: NColin King <colin.king@canonical.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 35726d3a ("perf probe: Fix to cut off incompatible chars from group name")
Link: http://lkml.kernel.org/r/20161003103431.18534-1-colin.king@canonical.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 41aad2a6
......@@ -213,7 +213,7 @@ static int convert_exec_to_group(const char *exec, char **result)
goto out;
}
for (ptr2 = ptr1; ptr2 != '\0'; ptr2++) {
for (ptr2 = ptr1; *ptr2 != '\0'; ptr2++) {
if (!isalnum(*ptr2) && *ptr2 != '_') {
*ptr2 = '\0';
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册