diff mbox series

[bpf-next,v1,4/6] selftests/bpf: Fix non-C89 loop variable declaration instances

Message ID 20211105234243.390179-5-memxor@gmail.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series Change bpftool, libbpf, selftests to force GNU89 mode | expand

Checks

Context Check Description
bpf/vmtest-bpf-next success VM_Test
bpf/vmtest-bpf-next-PR success PR summary
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 14 maintainers not CCed: songliubraving@fb.com kuba@kernel.org sunyucong@gmail.com shuah@kernel.org daniel@iogearbox.net john.fastabend@gmail.com netdev@vger.kernel.org ast@kernel.org kafai@fb.com hawk@kernel.org linux-kselftest@vger.kernel.org yhs@fb.com davem@davemloft.net kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 66 lines checked
netdev/kdoc success Errors and warnings before: 2 this patch: 2
netdev/source_inline success Was 0 now: 0

Commit Message

Kumar Kartikeya Dwivedi Nov. 5, 2021, 11:42 p.m. UTC
Fix the `int i` declaration inside the for statement. This is non-C89
compliant. Doing all of them in this change since they are trivial.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/d_path.c      | 4 ++--
 tools/testing/selftests/bpf/prog_tests/timer_mim.c   | 6 +++---
 tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 4 ++--
 tools/testing/selftests/bpf/test_progs.c             | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/d_path.c b/tools/testing/selftests/bpf/prog_tests/d_path.c
index 0a577a248d34..cc787ad68081 100644
--- a/tools/testing/selftests/bpf/prog_tests/d_path.c
+++ b/tools/testing/selftests/bpf/prog_tests/d_path.c
@@ -103,7 +103,7 @@  void test_d_path(void)
 {
 	struct test_d_path__bss *bss;
 	struct test_d_path *skel;
-	int err;
+	int err, i;
 
 	skel = test_d_path__open_and_load();
 	if (CHECK(!skel, "setup", "d_path skeleton failed\n"))
@@ -130,7 +130,7 @@  void test_d_path(void)
 		  "trampoline for filp_close was not called\n"))
 		goto cleanup;
 
-	for (int i = 0; i < MAX_FILES; i++) {
+	for (i = 0; i < MAX_FILES; i++) {
 		CHECK(strncmp(src.paths[i], bss->paths_stat[i], MAX_PATH_LEN),
 		      "check",
 		      "failed to get stat path[%d]: %s vs %s\n",
diff --git a/tools/testing/selftests/bpf/prog_tests/timer_mim.c b/tools/testing/selftests/bpf/prog_tests/timer_mim.c
index 949a0617869d..f12536c32e2d 100644
--- a/tools/testing/selftests/bpf/prog_tests/timer_mim.c
+++ b/tools/testing/selftests/bpf/prog_tests/timer_mim.c
@@ -6,9 +6,9 @@ 
 
 static int timer_mim(struct timer_mim *timer_skel)
 {
+	int err, prog_fd, key1 = 1, i;
 	__u32 duration = 0, retval;
 	__u64 cnt1, cnt2;
-	int err, prog_fd, key1 = 1;
 
 	err = timer_mim__attach(timer_skel);
 	if (!ASSERT_OK(err, "timer_attach"))
@@ -23,7 +23,7 @@  static int timer_mim(struct timer_mim *timer_skel)
 
 	/* check that timer_cb[12] are incrementing 'cnt' */
 	cnt1 = READ_ONCE(timer_skel->bss->cnt);
-	for (int i = 0; i < 100; i++) {
+	for (i = 0; i < 100; i++) {
 		cnt2 = READ_ONCE(timer_skel->bss->cnt);
 		if (cnt2 != cnt1)
 			break;
@@ -41,7 +41,7 @@  static int timer_mim(struct timer_mim *timer_skel)
 
 	/* check that timer_cb[12] are no longer running */
 	cnt1 = READ_ONCE(timer_skel->bss->cnt);
-	for (int i = 0; i < 100; i++) {
+	for (i = 0; i < 100; i++) {
 		usleep(200); /* 100 times more than interval */
 		cnt2 = READ_ONCE(timer_skel->bss->cnt);
 		if (cnt2 == cnt1)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
index faa22b84f2ee..e5b8666e59eb 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
@@ -335,7 +335,7 @@  static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons)
 {
 	static const char * const ifaces[] = {"bond2", "veth2_1", "veth2_2"};
 	int veth1_1_rx, veth1_2_rx;
-	int err;
+	int err, i;
 
 	if (bonding_setup(skeletons, BOND_MODE_ROUNDROBIN, BOND_XMIT_POLICY_LAYER23,
 			  BOND_ONE_NO_ATTACH))
@@ -346,7 +346,7 @@  static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons)
 		goto out;
 
 	/* populate the devmap with the relevant interfaces */
-	for (int i = 0; i < ARRAY_SIZE(ifaces); i++) {
+	for (i = 0; i < ARRAY_SIZE(ifaces); i++) {
 		int ifindex = if_nametoindex(ifaces[i]);
 		int map_fd = bpf_map__fd(skeletons->xdp_redirect_multi_kern->maps.map_all);
 
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index c65986bd9d07..0096051e7560 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1146,7 +1146,7 @@  static int server_main(void)
 	/* run serial tests */
 	save_netns();
 
-	for (int i = 0; i < prog_test_cnt; i++) {
+	for (i = 0; i < prog_test_cnt; i++) {
 		struct prog_test_def *test = &prog_test_defs[i];
 		struct test_result *result = &test_results[i];