Skip to contentSkip to conversation

selftests/bpf: initialize duration in xdp_noinline.c

PATCH Applied Stanislav Fomichev 3 participants 3 messages Oct 1, 2020 – Oct 2, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: initialize duration in xdp_noinline.c

Fixes clang error:
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c:35:6: error: variable 'duration' is uninitialized when used here [-Werror,-Wuninitialized]

        if (CHECK(!skel, "skel_open_and_load", "failed\n"))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 tools/testing/selftests/bpf/prog_tests/xdp_noinline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c +1 -1
index a1f06424cf83..0281095de266 100644
@@ -25,7 +25,7 @@ void test_xdp_noinline(void)
 		__u8 flags;
 	} real_def = {.dst = MAGIC_VAL};
 	__u32 ch_key = 11, real_num = 3;
-	__u32 duration, retval, size;
+	__u32 duration = 0, retval, size;
 	int err, i;
 	__u64 bytes = 0, pkts = 0;
 	char buf[128];
Signature · 1 line
2.28.0.709.gb0816b6eb0-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Stanislav Fomichev

Fixes clang error:
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c:35:6: error: variable 'duration' is uninitialized when used here [-Werror,-Wuninitialized]

        if (CHECK(!skel, "skel_open_and_load", "failed\n"))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 tools/testing/selftests/bpf/prog_tests/xdp_noinline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c +0 -0
index a1f06424cf83..0281095de266 100644

tools/testing/selftests/bpf/prog_tests/xdp_noinline.c void test_xdp_noinline(void) · line 28

Quoted 5 lines
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c +1 -1
@@ -25,7 +25,7 @@ void test_xdp_noinline(void)
 		__u8 flags;
 	} real_def = {.dst = MAGIC_VAL};
 	__u32 ch_key = 11, real_num = 3;
-	__u32 duration, retval, size;
+	__u32 duration = 0, retval, size;
#2 lore raw
In reply to Stanislav Fomichev
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 8 lines · On Thu, 1 Oct 2020 15:54:40 -0700 you wrote:

Fixes clang error:
tools/testing/selftests/bpf/prog_tests/xdp_noinline.c:35:6: error: variable 'duration' is uninitialized when used here [-Werror,-Wuninitialized]

        if (CHECK(!skel, "skel_open_and_load", "failed\n"))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Here is the summary with links:
- [bpf-next] selftests/bpf: initialize duration in xdp_noinline.c

    https://git.kernel.org/bpf/bpf-next/c/cffcdbff70a3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html