Commit c8ed6685 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov
Browse files

selftests/bpf: fix lots of silly mistakes pointed out by compiler



Once we enable -Wall for BPF sources, compiler will complain about lots
of unused variables, variables that are set but never read, etc.

Fix all these issues first before enabling -Wall in Makefile.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230309054015.4068562-4-andrii@kernel.org


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 713461b8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ int dump_ksym(struct bpf_iter__ksym *ctx)
	__u32 seq_num = ctx->meta->seq_num;
	unsigned long value;
	char type;
	int ret;

	if (!iter)
		return 0;
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ int change_tcp_cc(struct bpf_iter__tcp *ctx)
	char cur_cc[TCP_CA_NAME_MAX];
	struct tcp_sock *tp;
	struct sock *sk;
	int ret;

	if (!bpf_tcp_sk(ctx->sk_common))
		return 0;
+0 −2
Original line number Diff line number Diff line
@@ -138,8 +138,6 @@ static int callback_set_0f(int i, void *ctx)
SEC("fentry/" SYS_PREFIX "sys_nanosleep")
int prog_non_constant_callback(void *ctx)
{
	struct callback_ctx data = {};

	if (bpf_get_current_pid_tgid() >> 32 != pid)
		return 0;

+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ int leak_prog(void *ctx)
{
	struct prog_test_ref_kfunc *p;
	struct map_value *v;
	unsigned long sl;

	v = bpf_map_lookup_elem(&array_map, &(int){0});
	if (!v)
+0 −1
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ static inline int is_allowed_peer_cg(struct __sk_buff *skb,
SEC("cgroup_skb/ingress")
int ingress_lookup(struct __sk_buff *skb)
{
	__u32 serv_port_key = 0;
	struct ipv6hdr ip6h;
	struct tcphdr tcph;

Loading