Skip to content

Commit

Permalink
patches: Add fix for -Wc23-extensions in net/ipv4/tcp_output.c
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance committed Nov 1, 2023
1 parent 1a1b015 commit 1ec9b2d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
@@ -0,0 +1,60 @@
From git@z Thu Jan 1 00:00:00 1970
Subject: [PATCH] tcp: Fix -Wc23-extensions in tcp_options_write()
From: Nathan Chancellor <nathan@kernel.org>
Date: Tue, 31 Oct 2023 13:23:35 -0700
Message-Id: <20231031-tcp-ao-fix-label-in-compound-statement-warning-v1-1-c9731d115f17@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Clang warns (or errors with CONFIG_WERROR=y) when CONFIG_TCP_AO is set:

net/ipv4/tcp_output.c:663:2: error: label at end of compound statement is a C23 extension [-Werror,-Wc23-extensions]
663 | }
| ^
1 error generated.

On earlier releases (such as clang-11, the current minimum supported
version for building the kernel) that do not support C23, this was a
hard error unconditionally:

net/ipv4/tcp_output.c:663:2: error: expected statement
}
^
1 error generated.

Add a semicolon after the label to create an empty statement, which
resolves the warning or error for all compilers.

Closes: https://github.com/ClangBuiltLinux/linux/issues/1953
Fixes: 1e03d32bea8e ("net/tcp: Add TCP-AO sign to outgoing packets")
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20231031-tcp-ao-fix-label-in-compound-statement-warning-v1-1-c9731d115f17@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
net/ipv4/tcp_output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f558c054cf6e..6064895daece 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -658,7 +658,7 @@ static void tcp_options_write(struct tcphdr *th, struct tcp_sock *tp,
memset(ptr, TCPOPT_NOP, sizeof(*ptr));
ptr++;
}
-out_ao:
+out_ao:;
#endif
}
if (unlikely(opts->mss)) {

---
base-commit: 55c900477f5b3897d9038446f72a281cae0efd86
change-id: 20231031-tcp-ao-fix-label-in-compound-statement-warning-ebd6c9978498

Best regards,
--
Nathan Chancellor <nathan@kernel.org>

1 change: 1 addition & 0 deletions patches/mainline/series
@@ -0,0 +1 @@
20231031_nathan_tcp_fix_wc23_extensions_in_tcp_options_write.patch

0 comments on commit 1ec9b2d

Please sign in to comment.