perf probe: check if *ptr2 is zero and not ptr2
PATCH 1/1 perf probe: check if *ptr2 is zero and not ptr2
From: Colin Ian King <[email protected]>
Static anaylsis with cppcheck 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.
--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-event.c +1 -1
@@ -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 ;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerEm Mon, Oct 03, 2016 at 11:34:31AM +0100, Colin King escreveu:
Quoted 5 lines
From: Colin Ian King <[email protected]>
Static anaylsis with cppcheck detected an incorrect comparison:
[tools/perf/util/probe-event.c:216]: (warning) Char literal compared with pointer 'ptr2'. Did you intend to dereference it?
What tool was used for that?
- Arnaldo
Quoted 23 lines
Dereference ptr2 for the comparison to fix this.
Fixes 35726d3a4ca9 ("perf probe: Fix to cut off incompatible chars from group name")Signed-off-by Colin Ian King <[email protected]>--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/probe-event.c +1
-1@@ -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 ;Signature · 1 line
2.9.3
Quoted 8 lines · Arnaldo Carvalho de Melo
Em Mon, Oct 03, 2016 at 11:34:31AM +0100, Colin King escreveu:
Quoted 5 lines
From: Colin Ian King <[email protected]>
Static anaylsis with cppcheck detected an incorrect comparison:
[tools/perf/util/probe-event.c:216]: (warning) Char literal compared with pointer 'ptr2'. Did you intend to dereference it?What tool was used for that?
cppcheck https://github.com/danmar/cppcheck - I run it nearly daily on linux-next and linux
Quoted 26 lines
- Arnaldo
Quoted 23 lines
Dereference ptr2 for the comparison to fix this.
Fixes 35726d3a4ca9 ("perf probe: Fix to cut off incompatible chars from group name")Signed-off-by Colin Ian King <[email protected]>--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/probe-event.c +1
-1@@ -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 ;Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerEm Mon, Oct 03, 2016 at 12:22:25PM +0100, Colin Ian King escreveu:
Quoted 12 lines · Arnaldo Carvalho de Melo
Quoted 8 lines
Em Mon, Oct 03, 2016 at 11:34:31AM +0100, Colin King escreveu:
Quoted 5 lines
From: Colin Ian King <[email protected]>
Static anaylsis with cppcheck detected an incorrect comparison:
[tools/perf/util/probe-event.c:216]: (warning) Char literal compared with pointer 'ptr2'. Did you intend to dereference it?What tool was used for that?
cppcheck https://github.com/danmar/cppcheck - I run it nearly daily on linux-next and linux
Thanks, I'll try to get it and use it before upstreaming stuff,
- Arnaldo
Quoted 26 lines
Quoted 26 lines
- Arnaldo
Quoted 23 lines
Dereference ptr2 for the comparison to fix this.
Fixes 35726d3a4ca9 ("perf probe: Fix to cut off incompatible chars from group name")Signed-off-by Colin Ian King <[email protected]>--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/probe-event.c +1
-1@@ -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 ;Signature · 1 line
2.9.3
Quoted 7 lines · On Mon, 3 Oct 2016 11:34:31 +0100 Colin King <[email protected]> wrote:
From: Colin Ian King <[email protected]>
Static anaylsis with cppcheck 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.
Oops, right!
Thanks!
Quoted 23 lines
Fixes 35726d3a4ca9 ("perf probe: Fix to cut off incompatible chars from group name")Signed-off-by Colin Ian King <[email protected]>--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/probe-event.c +1
-1@@ -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 ;Signature · 1 line
2.9.3
Signature · 1 line
Masami Hiramatsu <[email protected]>
tip-bot for Colin Ian King
merge bot[tip:perf/urgent] perf probe: Check if *ptr2 is zero and not ptr2
In reply to Colin Kingperf probe: Check if *ptr2 is zero and not ptr2
Commit-ID: ead1a57457c0324a167f3f9e3a70e26c2d75fb12 Gitweb: http://git.kernel.org/tip/ead1a57457c0324a167f3f9e3a70e26c2d75fb12 Author: Colin Ian King <[email protected]> AuthorDate: Mon, 3 Oct 2016 11:34:31 +0100 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 3 Oct 2016 11:24:12 -0300
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/
--- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-event.c +1 -1
@@ -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 ;