mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
selftests/bpf: Fix return value checks in perf_event_stackmap test
The bpf_get_stackid() function may also return 0 on success as per UAPI BPF helper documentation. Therefore, 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> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20220408041452.933944-1-ytcoode@gmail.com
This commit is contained in:
parent
8555defe48
commit
658d87687c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user