linux/tools/testing
Martin KaFai Lau e710bcc6d9 bpf: selftest: Ensure the return value of bpf_skc_to helpers must be checked
This patch tests:

int bpf_cls(struct __sk_buff *skb)
{
	/* REG_6: sk
	 * REG_7: tp
	 * REG_8: req_sk
	 */

	sk = skb->sk;
	if (!sk)
		return 0;

	tp = bpf_skc_to_tcp_sock(sk);
	req_sk = bpf_skc_to_tcp_request_sock(sk);
	if (!req_sk)
		return 0;

	/* !tp has not been tested, so verifier should reject. */
	return *(__u8 *)tp;
}

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201019194219.1051314-1-kafai@fb.com
2020-10-19 15:57:42 -07:00
..
fault-injection
ktest Updates for ktest 5.9 2020-08-10 19:16:26 -07:00
kunit kunit: tool: fix display of make errors 2020-10-09 14:04:09 -06:00
nvdimm device-dax: add dis-contiguous resource support 2020-10-13 18:38:28 -07:00
radix-tree SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00
scatterlist
selftests bpf: selftest: Ensure the return value of bpf_skc_to helpers must be checked 2020-10-19 15:57:42 -07:00
vsock SPDX patches for 5.7-rc1. 2020-04-03 13:12:26 -07:00