Skip to contentSkip to conversation

bfp tools: Couple Coverity fixes

PATCH Applied Florian Fainelli 5 participants 13 messages Apr 25, 2016 – May 1, 2016

lore
Share & tools
lore
#0 lore raw

cover bfp tools: Couple Coverity fixes

Hi all,

Two trivial patches that were flagged by Coverity.

Thanks!

Florian Fainelli (2):
bfp tools: Remove expression with no effect
bfp tools: Fix syscall argument

 tools/build/feature/test-bpf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 bfp tools: Remove expression with no effect

Assigning "attr" to "attr" does not have any effect, but was caught by Coverity, so let's remove this.

Reported-by coverity (CID 1354720)
Fixes 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
---
 tools/build/feature/test-bpf.c | 1 -
 1 file changed, 1 deletion(-)
tools/build/feature/test-bpf.c +0 -1
index b389026839b9..8236df9a46ca 100644
@@ -27,7 +27,6 @@ int main(void)
 	attr.log_level = 0;
 	attr.kern_version = 0;
 
-	attr = attr;
 	/*
 	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
 	 * This call should fail if we run the testcase.
Signature · 1 line
2.7.4
Tested-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] bfp tools: Remove expression with no effect

Quoted 15 lines · Florian Fainelli

Assigning "attr" to "attr" does not have any effect, but was caught by Coverity, so let's remove this.

Reported-by coverity (CID 1354720)
Fixes 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
---
  tools/build/feature/test-bpf.c | 1 -
  1 file changed, 1 deletion(-)
tools/build/feature/test-bpf.c +0 -0
index b389026839b9..8236df9a46ca 100644

tools/build/feature/test-bpf.c int main(void) · line 32

Quoted 7 lines
tools/build/feature/test-bpf.c +0 -1
@@ -27,7 +27,6 @@ int main(void)
  	attr.log_level = 0;
  	attr.kern_version = 0;
 
-	attr = attr;
  	/*
  	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
  	 * This call should fail if we run the testcase.
#3 lore raw

Re: [PATCH 1/2] bfp tools: Remove expression with no effect

Em Wed, Apr 27, 2016 at 11:11:26AM +0800, Wangnan (F) escreveu:

Quoted 13 lines · Florian Fainelli
Quoted 10 lines

Assigning "attr" to "attr" does not have any effect, but was caught by Coverity, so let's remove this.

Reported-by coverity (CID 1354720)
Fixes 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
---
 tools/build/feature/test-bpf.c | 1 -
 1 file changed, 1 deletion(-)
Quoted 13 lines

tools/build/feature/test-bpf.c int main(void) · line 31

Quoted 11 lines
tools/build/feature/test-bpf.c +0 -1
index b389026839b9..8236df9a46ca 100644
@@ -27,7 +27,6 @@ int main(void)
 	attr.log_level = 0;
 	attr.kern_version = 0;
-	attr = attr;
 	/*
 	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
 	 * This call should fail if we run the testcase.

Applied

#4 lore raw

[tip:perf/core] bpf tools: Remove expression with no effect

In reply to Florian Fainelli
bpf tools: Remove expression with no effect
Commit-ID:  a431d67934dfe9ffbe65972b0dbe576331595186
Gitweb:     http://git.kernel.org/tip/a431d67934dfe9ffbe65972b0dbe576331595186
Author:     Florian Fainelli <[email protected]>
AuthorDate: Sun, 24 Apr 2016 19:34:53 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 28 Apr 2016 09:58:57 -0300

bpf tools: Remove expression with no effect

Assigning "attr" to "attr" does not have any effect, but was caught by Coverity, so let's remove this.

Reported-by coverity (CID 1354720)
Cc Jiri Olsa <[email protected]>
Fixes 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
---
 tools/build/feature/test-bpf.c | 1 -
 1 file changed, 1 deletion(-)
tools/build/feature/test-bpf.c +0 -1
index b389026..8236df9 100644
@@ -27,7 +27,6 @@ int main(void)
 	attr.log_level = 0;
 	attr.kern_version = 0;
 
-	attr = attr;
 	/*
 	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
 	 * This call should fail if we run the testcase.
#5 lore raw

PATCH 2/2 bfp tools: Fix syscall argument

In reply to Florian Fainelli

Coverity flagged this under CID 1354884 as a sizeof mismatch, it turns out that the argument "attr" passed to syscall should have been a pointer to attr in the first place.

Reported-by coverity (CID 1354884)
Fixes 8f9e05fb298f ("perf tools: Fix PowerPC native building")
---
 tools/build/feature/test-bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/test-bpf.c +1 -1
index 8236df9a46ca..e04ab89a1013 100644
@@ -31,5 +31,5 @@ int main(void)
 	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
 	 * This call should fail if we run the testcase.
 	 */
-	return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
+	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
 }
Signature · 1 line
2.7.4
Acked-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] bfp tools: Fix syscall argument

Quoted 16 lines · Florian Fainelli

Coverity flagged this under CID 1354884 as a sizeof mismatch, it turns out that the argument "attr" passed to syscall should have been a pointer to attr in the first place.

Reported-by coverity (CID 1354884)
Fixes 8f9e05fb298f ("perf tools: Fix PowerPC native building")
---
  tools/build/feature/test-bpf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/test-bpf.c +0 -0
index 8236df9a46ca..e04ab89a1013 100644

tools/build/feature/test-bpf.c int main(void) · line 35

Quoted 6 lines
tools/build/feature/test-bpf.c +1 -1
@@ -31,5 +31,5 @@ int main(void)
  	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
  	 * This call should fail if we run the testcase.
  	 */
-	return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
+	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
  }
#7 lore raw

Re: [PATCH 2/2] bfp tools: Fix syscall argument

Em Wed, Apr 27, 2016 at 11:01:43AM +0800, Wangnan (F) escreveu:

Quoted 5 lines · Florian Fainelli

tools/build/feature/test-bpf.c int main(void) · line 35

Quoted 3 lines
tools/build/feature/test-bpf.c +1 -1
-	return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
+	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
 }

Applied, thanks.

- Arnaldo

#8 lore raw

[tip:perf/core] bpf tools: Fix syscall argument

In reply to Florian Fainelli
bpf tools: Fix syscall argument
Commit-ID:  1a71476e4f2693ed93523c80ff1e2d4a8634717c
Gitweb:     http://git.kernel.org/tip/1a71476e4f2693ed93523c80ff1e2d4a8634717c
Author:     Florian Fainelli <[email protected]>
AuthorDate: Sun, 24 Apr 2016 19:34:54 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 28 Apr 2016 09:58:57 -0300

bpf tools: Fix syscall argument

Coverity flagged this under CID 1354884 as a sizeof mismatch, it turns out that the argument "attr" passed to syscall should have been a pointer to attr in the first place.

Reported-by coverity (CID 1354884)
Cc Jiri Olsa <[email protected]>
Fixes 8f9e05fb298f ("perf tools: Fix PowerPC native building")
---
 tools/build/feature/test-bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/test-bpf.c +1 -1
index 8236df9..e04ab89 100644
@@ -31,5 +31,5 @@ int main(void)
 	 * Test existence of __NR_bpf and BPF_PROG_LOAD.
 	 * This call should fail if we run the testcase.
 	 */
-	return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
+	return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
 }
#10 lore raw
Quoted 7 lines · Florian Fainelli
Quoted 5 lines · Florian Fainelli

Hi all,

Two trivial patches that were flagged by Coverity.

Thanks!

Ping! Did I send this to the correct mailing-list?

Sorry for the late. You are on the right list :)

#11 lore raw
Quoted 4 lines · Wangnan (F)
Quoted 1 line · Florian Fainelli

Le 24/04/2016 19:34, Florian Fainelli a écrit :

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

Hi all,

Two trivial patches that were flagged by Coverity.

Thanks!

Ping! Did I send this to the correct mailing-list?

Sorry for the late. You are on the right list :)

Arnaldo, please take a look. They look good to me.

#12 lore raw

Em Tue, Apr 26, 2016 at 08:08:18PM -0700, Alexei Starovoitov escreveu:

Quoted 7 lines · Wangnan (F)
Quoted 6 lines · Florian Fainelli
Quoted 3 lines · Florian Fainelli
Quoted 2 lines

Hi all,

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

Two trivial patches that were flagged by Coverity.

Thanks!

Ping! Did I send this to the correct mailing-list?

Sorry for the late. You are on the right list :)

Arnaldo, please take a look. They look good to me.

Will do, just readying it a 30-patch long pull req to Ingo, will collect those for the next one, with your Acked-by tags.

- Arnaldo