diff options
author | John Fastabend <john.fastabend@gmail.com> | 2020-05-21 13:08:26 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-05-21 17:44:25 -0700 |
commit | d844a71bff0fd899146e5981ec44b618afd17d83 (patch) | |
tree | 26ac9a5812fa137c7ba21cf91a1f083ba39dbd67 /tools/testing/selftests/bpf | |
parent | f9b16ec0eeb75337aef38954a4066e6eecd7cfe5 (diff) | |
download | linux-d844a71bff0fd899146e5981ec44b618afd17d83.tar.gz linux-d844a71bff0fd899146e5981ec44b618afd17d83.tar.bz2 linux-d844a71bff0fd899146e5981ec44b618afd17d83.zip |
bpf: Selftests, add printk to test_sk_lookup_kern to encode null ptr check
Adding a printk to test_sk_lookup_kern created the reported failure
where a pointer type is checked twice for NULL. Lets add it to the
progs test test_sk_lookup_kern.c so we test the case from C all the
way into the verifier.
We already have printk's in selftests so seems OK to add another one.
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/159009170603.6313.1715279795045285176.stgit@john-Precision-5820-Tower
Diffstat (limited to 'tools/testing/selftests/bpf')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c index d2b38fa6a5b0..e83d0b48d80c 100644 --- a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c +++ b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c @@ -73,6 +73,7 @@ int bpf_sk_lookup_test0(struct __sk_buff *skb) tuple_len = ipv4 ? sizeof(tuple->ipv4) : sizeof(tuple->ipv6); sk = bpf_sk_lookup_tcp(skb, tuple, tuple_len, BPF_F_CURRENT_NETNS, 0); + bpf_printk("sk=%d\n", sk ? 1 : 0); if (sk) bpf_sk_release(sk); return sk ? TC_ACT_OK : TC_ACT_UNSPEC; |