perf tests: evsel-tp-sched: Fix bitwise operator
PATCH 1/1 perf tests: evsel-tp-sched: Fix bitwise operator
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
This bug was detected with the help of Coccinelle.
---
NOTE: Notice that this code has been there since 2012. So, it would
be helpful if someone can double-check this. Thanks.
tools/perf/tests/evsel-tp-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/evsel-tp-sched.c +1 -1
@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,return -1 ; } - is_signed = !!(field->flags |TEP_FIELD_IS_SIGNED ); + is_signed = !!(field->flags &TEP_FIELD_IS_SIGNED );if (should_be_signed && !is_signed) {pr_debug ("%s: \"%s\" signedness(%d) is wrong, should be %d\n" , evsel->name, name, is_signed, should_be_signed);
Signature · 1 line
2.20.1
Quoted 11 lines · Gustavo A. R. Silva
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
This bug was detected with the help of Coccinelle.
Fixes 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format fields")Signed-off-by Gustavo A. R. Silva <[email protected]>
nice catch
thanks,
jirka
Quoted 24 lines
---
NOTE: Notice that this code has been there since 2012. So, it would
be helpful if someone can double-check this. Thanks.tools/perf/tests/evsel-tp-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/evsel-tp-sched.c +1
-1@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,return -1 ; } - is_signed = !!(field->flags |TEP_FIELD_IS_SIGNED ); + is_signed = !!(field->flags &TEP_FIELD_IS_SIGNED );if (should_be_signed && !is_signed) {pr_debug ("%s: \"%s\" signedness(%d) is wrong, should be %d\n" , evsel->name, name, is_signed, should_be_signed);Signature · 1 line
2.20.1
Quoted 7 lines · Jiri Olsa
Quoted 6 lines · Gustavo A. R. Silva
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
Quoted 8 lines
Quoted 5 lines
This bug was detected with the help of Coccinelle.
Fixes 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format fields")Signed-off-by Gustavo A. R. Silva <[email protected]>nice catch
Glad to help. :)
Quoted 2 lines
Acked-by Jiri Olsa <[email protected]>
Thanks
--
Gustavo
Quoted 28 lines
thanks,
jirkaQuoted 24 lines
---
NOTE: Notice that this code has been there since 2012. So, it would
be helpful if someone can double-check this. Thanks.tools/perf/tests/evsel-tp-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/evsel-tp-sched.c +1
-1@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,return -1 ; } - is_signed = !!(field->flags |TEP_FIELD_IS_SIGNED ); + is_signed = !!(field->flags &TEP_FIELD_IS_SIGNED );if (should_be_signed && !is_signed) {pr_debug ("%s: \"%s\" signedness(%d) is wrong, should be %d\n" , evsel->name, name, is_signed, should_be_signed);Signature · 1 line
2.20.1
Hi all,
Friendly ping:
Who can take this?
Thanks
--
Gustavo
Quoted 56 lines · Gustavo A. R. Silva
Quoted 7 lines · Jiri Olsa
Quoted 6 lines · Gustavo A. R. Silva
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
Quoted 8 lines
Quoted 5 lines
This bug was detected with the help of Coccinelle.
Fixes 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format fields")Signed-off-by Gustavo A. R. Silva <[email protected]>nice catch
Glad to help. :)
Quoted 2 lines
Acked-by Jiri Olsa <[email protected]>Thanks
--
GustavoQuoted 28 lines
thanks,
jirkaQuoted 24 lines
---
NOTE: Notice that this code has been there since 2012. So, it would
be helpful if someone can double-check this. Thanks.tools/perf/tests/evsel-tp-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/tests/evsel-tp-sched.c +1
-1@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,return -1 ; } - is_signed = !!(field->flags |TEP_FIELD_IS_SIGNED ); + is_signed = !!(field->flags &TEP_FIELD_IS_SIGNED );if (should_be_signed && !is_signed) {pr_debug ("%s: \"%s\" signedness(%d) is wrong, should be %d\n" , evsel->name, name, is_signed, should_be_signed);Signature · 1 line
2.20.1
Arnaldo Carvalho de Melo
maintainerEm Wed, Jan 23, 2019 at 09:33:38AM +0100, Jiri Olsa escreveu:
Quoted 9 lines · Gustavo A. R. Silva
Quoted 8 lines
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
This bug was detected with the help of Coccinelle.
Quoted 7 lines
Quoted 3 lines
Fixes 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format fields")Signed-off-by Gustavo A. R. Silva <[email protected]>nice catch
Acked-by Jiri Olsa <[email protected]>
Argh, applied, and looking for an old brown paper bag...
- Arnaldo
tip-bot for Gustavo A. R. Silva
merge bot[tip:perf/urgent] perf tests evsel-tp-sched: Fix bitwise operator
In reply to Gustavo A. R. Silvaperf tests evsel-tp-sched: Fix bitwise operator
Commit-ID: 489338a717a0dfbbd5a3fabccf172b78f0ac9015 Gitweb: https://git.kernel.org/tip/489338a717a0dfbbd5a3fabccf172b78f0ac9015 Author: Gustavo A. R. Silva <[email protected]> AuthorDate: Tue, 22 Jan 2019 17:34:39 -0600 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Feb 2019 11:32:14 -0300
perf tests evsel-tp-sched: Fix bitwise operator
Notice that the use of the bitwise OR operator '|' always leads to true in this particular case, which seems a bit suspicious due to the context in which this expression is being used.
Fix this by using bitwise AND operator '&' instead.
This bug was detected with the help of Coccinelle.
--- tools/perf/tests/evsel-tp-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/evsel-tp-sched.c +1 -1
@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,return -1 ; } - is_signed = !!(field->flags |TEP_FIELD_IS_SIGNED ); + is_signed = !!(field->flags &TEP_FIELD_IS_SIGNED );if (should_be_signed && !is_signed) {pr_debug ("%s: \"%s\" signedness(%d) is wrong, should be %d\n" , evsel->name, name, is_signed, should_be_signed);