Skip to contentSkip to conversation

bpf: selftests: Fix error checking on reading the tcp_fastopen sysctl

PATCH Applied Martin KaFai Lau 3 participants 3 messages Feb 11, 2020 – Feb 12, 2020

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

PATCH 1/1 bpf: selftests: Fix error checking on reading the tcp_fastopen sysctl

There is a typo in checking the "saved_tcp_fo" and instead "saved_tcp_syncookie" is checked again. This patch fixes it and also breaks them into separate if statements such that the test will abort asap.

---
 tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/select_reuseport.c +3 -1
index 098bcae5f827..b577666d028e 100644
@@ -822,8 +822,10 @@ void test_select_reuseport(void)
 		goto out;
 
 	saved_tcp_fo = read_int_sysctl(TCP_FO_SYSCTL);
+	if (saved_tcp_fo < 0)
+		goto out;
 	saved_tcp_syncookie = read_int_sysctl(TCP_SYNCOOKIE_SYSCTL);
-	if (saved_tcp_syncookie < 0 || saved_tcp_syncookie < 0)
+	if (saved_tcp_syncookie < 0)
 		goto out;
 
 	if (enable_fastopen())
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Martin KaFai Lau

There is a typo in checking the "saved_tcp_fo" and instead "saved_tcp_syncookie" is checked again. This patch fixes it and also breaks them into separate if statements such that the test will abort asap.

---

Quoted 22 lines
 tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/select_reuseport.c +3 -2
index 098bcae5f827..b577666d028e 100644
@@ -822,8 +822,10 @@ void test_select_reuseport(void)
                goto out;
 
        saved_tcp_fo = read_int_sysctl(TCP_FO_SYSCTL);
+       if (saved_tcp_fo < 0)
+               goto out;
        saved_tcp_syncookie = read_int_sysctl(TCP_SYNCOOKIE_SYSCTL);
-       if (saved_tcp_syncookie < 0 || saved_tcp_syncookie < 0)
+       if (saved_tcp_syncookie < 0)
                goto out;
 
        if (enable_fastopen())
--

2.17.1