netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tcp: Fix -Wc23-extensions in tcp_options_write()
@ 2023-10-31 20:23 Nathan Chancellor
  2023-10-31 21:49 ` Nick Desaulniers
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Nathan Chancellor @ 2023-10-31 20:23 UTC (permalink / raw)
  To: edumazet, davem, dsahern, kuba, pabeni
  Cc: ndesaulniers, trix, 0x7f454c46, fruggeri, noureddine, netdev,
	linux-kernel, llvm, patches, Nathan Chancellor

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")
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>


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-11-06  7:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 20:23 [PATCH net] tcp: Fix -Wc23-extensions in tcp_options_write() Nathan Chancellor
2023-10-31 21:49 ` Nick Desaulniers
2023-11-01  4:49 ` Eric Dumazet
2023-11-02  0:41 ` Palmer Dabbelt
2023-11-02  1:07   ` Nathan Chancellor
2023-11-02  1:42     ` Palmer Dabbelt
2023-11-02 20:23       ` Palmer Dabbelt
2023-11-03  8:22 ` Christoph Hellwig
2023-11-03 16:53   ` Nathan Chancellor
2023-11-06  7:49     ` Christoph Hellwig
2023-11-03 16:57   ` Nick Desaulniers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).