diff mbox series

[bpf-next,v2] selftests/bpf: Fix return value checks in perf_event_stackmap.c

Message ID 20220408041452.933944-1-ytcoode@gmail.com (mailing list archive)
State Accepted
Commit 658d87687cd5a6c8762d1de8abee1e6792d8d71e
Delegated to: BPF
Headers show
Series [bpf-next,v2] selftests/bpf: Fix return value checks in perf_event_stackmap.c | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 12 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest + selftests
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Kernel LATEST on z15 + selftests

Commit Message

Yuntao Wang April 8, 2022, 4:14 a.m. UTC
The bpf_get_stackid() function may also return 0 on success.

Correct checks from 'val > 0' to 'val >= 0' to ensure that they cover all
possible success return values.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
v1 -> v2: update commit message

 tools/testing/selftests/bpf/progs/perf_event_stackmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 8, 2022, 9:09 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Fri,  8 Apr 2022 12:14:52 +0800 you wrote:
> The bpf_get_stackid() function may also return 0 on success.
> 
> Correct checks from 'val > 0' to 'val >= 0' to ensure that they cover all
> possible success return values.
> 
> Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2] selftests/bpf: Fix return value checks in perf_event_stackmap.c
    https://git.kernel.org/bpf/bpf-next/c/658d87687cd5

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/perf_event_stackmap.c b/tools/testing/selftests/bpf/progs/perf_event_stackmap.c
index b3fcb5274ee0..f793280a3238 100644
--- a/tools/testing/selftests/bpf/progs/perf_event_stackmap.c
+++ b/tools/testing/selftests/bpf/progs/perf_event_stackmap.c
@@ -35,10 +35,10 @@  int oncpu(void *ctx)
 	long val;
 
 	val = bpf_get_stackid(ctx, &stackmap, 0);
-	if (val > 0)
+	if (val >= 0)
 		stackid_kernel = 2;
 	val = bpf_get_stackid(ctx, &stackmap, BPF_F_USER_STACK);
-	if (val > 0)
+	if (val >= 0)
 		stackid_user = 2;
 
 	trace = bpf_map_lookup_elem(&stackdata_map, &key);