diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index 08c833f94322..b44b9a9368b8 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -675,7 +675,7 @@ static int wait_for_token(int fd) { __u32 token; char *str; - int i, n; + int i; /* Wait max 2 sec for the connection to be established */ for (i = 0; i < 10; i++) { @@ -686,8 +686,7 @@ static int wait_for_token(int fd) str = get_events_str("type:2"); if (!str) continue; - n = sscanf(strstr(str, "token"), "token:%u,", &token); - if (n != 1) + if (sscanf(strstr(str, "token"), "token:%u,", &token) != 1) continue; return token; } @@ -700,17 +699,14 @@ static int userspace_pm_add_subflow(__u32 token, char *addr, __u8 id) bool ipv6 = strstr(addr, ":"); __u32 sport, dport; char *str; - int n; str = get_events_str("type:2"); if (!str) return -1; - n = sscanf(strstr(str, "sport"), "sport:%u,", &sport); - if (n != 1) + if (sscanf(strstr(str, "sport"), "sport:%u,", &sport) != 1) return -1; - n = sscanf(strstr(str, "dport"), "dport:%u,", &dport); - if (n != 1) + if (sscanf(strstr(str, "dport"), "dport:%u,", &dport) != 1) return -1; str = ipv6 ? (strstr(addr, ".") ? "::ffff:"ADDR_1 : ADDR6_1) : ADDR_1; SYS_NOFAIL("ip netns exec %s %s csf lip %s lid %u rip %s rport %u token %u", @@ -861,17 +857,14 @@ static int userspace_pm_set_flags(__u32 token, char *addr, char *flags) bool ipv6 = strstr(addr, ":"); __u32 sport, dport; char *str; - int n; str = get_events_str("type:10"); if (!str) return -1; - n = sscanf(strstr(str, "sport"), "sport:%u,", &sport); - if (n != 1) + if (sscanf(strstr(str, "sport"), "sport:%u,", &sport) != 1) return -1; - n = sscanf(strstr(str, "dport"), "dport:%u,", &dport); - if (n != 1) + if (sscanf(strstr(str, "dport"), "dport:%u,", &dport) != 1) return -1; str = ipv6 ? (strstr(addr, ".") ? "::ffff:"ADDR_1 : ADDR6_1) : ADDR_1; return SYS_NOFAIL("ip netns exec %s %s set %s port %u rip %s rport %u flags %s token %u", @@ -883,17 +876,14 @@ static int userspace_pm_rm_subflow(__u32 token, char *addr, __u8 id) bool ipv6 = strstr(addr, ":"); __u32 sport, dport; char *str; - int n; str = get_events_str("type:10"); if (!str) return -1; - n = sscanf(strstr(str, "sport"), "sport:%u,", &sport); - if (n != 1) + if (sscanf(strstr(str, "sport"), "sport:%u,", &sport) != 1) return -1; - n = sscanf(strstr(str, "dport"), "dport:%u,", &dport); - if (n != 1) + if (sscanf(strstr(str, "dport"), "dport:%u,", &dport) != 1) return -1; str = ipv6 ? (strstr(addr, ".") ? "::ffff:"ADDR_1 : ADDR6_1) : ADDR_1; return SYS_NOFAIL("ip netns exec %s %s dsf lip %s lport %u rip %s rport %u token %u",