Skip to contentSkip to conversation

selftests/bpf: fix compiler warnings in RELEASE=1 mode

PATCH Applied Andrii Nakryiko 4 participants 4 messages Dec 12, 2023 – Dec 13, 2023

Subsystems (4)
lore
Share & tools
lore

Andrii Nakryiko

author maintainer
#0 lore raw

PATCH 1/1 selftests/bpf: fix compiler warnings in RELEASE=1 mode

When compiling BPF selftests with RELEASE=1, we get two new warnings, which are treated as errors. Fix them.

---
 tools/testing/selftests/bpf/veristat.c        | 2 +-
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/veristat.c +1 -1
index 1d418d66e375..244d4996e06e 100644
@@ -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);
tools/testing/selftests/bpf/xdp_hw_metadata.c +1 -1
index 3291625ba4fb..c69c08933fdd 100644
@@ -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;
Signature · 1 line
2.34.1
#3 lore raw
In reply to Andrii Nakryiko
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 8 lines · On Tue, 12 Dec 2023 14:53:43 -0800 you wrote:

When compiling BPF selftests with RELEASE=1, we get two new warnings, which are treated as errors. Fix them.

---
 tools/testing/selftests/bpf/veristat.c        | 2 +-
 tools/testing/selftests/bpf/xdp_hw_metadata.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Here is the summary with links:
- [bpf-next] selftests/bpf: fix compiler warnings in RELEASE=1 mode

    https://git.kernel.org/bpf/bpf-next/c/62d9a969f4a9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html