selftests/bpf: fix compiler warnings in RELEASE=1 mode
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 12 Dec 2023 22:53:43 +0000 (14:53 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 13 Dec 2023 18:27:16 +0000 (10:27 -0800)
When compiling BPF selftests with RELEASE=1, we get two new
warnings, which are treated as errors. Fix them.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/r/20231212225343.1723081-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/veristat.c
tools/testing/selftests/bpf/xdp_hw_metadata.c

index 1d418d66e3758a6034b9c01acc51e7a7cc2b72ac..244d4996e06efe3eb2e9af7cd1d8a7700f3e6082 100644 (file)
@@ -1254,7 +1254,7 @@ static int cmp_join_stat(const struct verif_stats_join *s1,
                         bool asc, bool abs)
 {
        const char *str1 = NULL, *str2 = NULL;
-       double v1, v2;
+       double v1 = 0.0, v2 = 0.0;
        int cmp = 0;
 
        fetch_join_stat_value(s1, id, var, &str1, &v1);
index 3291625ba4fba986e7b5def6661744d2ccc9142b..c69c08933fdd397e918d4927495efe7e1e6b6f2b 100644 (file)
@@ -79,7 +79,7 @@ static int open_xsk(int ifindex, struct xsk *xsk, __u32 queue_id)
                .flags = XSK_UMEM__DEFAULT_FLAGS,
                .tx_metadata_len = sizeof(struct xsk_tx_metadata),
        };
-       __u32 idx;
+       __u32 idx = 0;
        u64 addr;
        int ret;
        int i;