diff mbox series

[net-next,1/5] nf_conntrack: fix -Wunused-const-variable=

Message ID 20230727133604.8275-2-fw@strlen.de (mailing list archive)
State Accepted
Commit a927d77778e380ffd6ffea1f2037c6bdb23af99a
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/5] nf_conntrack: fix -Wunused-const-variable= | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1342 this patch: 1342
netdev/cc_maintainers fail 1 blamed authors not CCed: kaber@trash.net; 4 maintainers not CCed: pablo@netfilter.org coreteam@netfilter.org kaber@trash.net kadlec@netfilter.org
netdev/build_clang success Errors and warnings before: 1365 this patch: 1365
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1365 this patch: 1365
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Florian Westphal July 27, 2023, 1:35 p.m. UTC
From: Zhu Wang <wangzhu9@huawei.com>

When building with W=1, the following warning occurs.

net/netfilter/nf_conntrack_proto_dccp.c:72:27: warning: ‘dccp_state_names’ defined but not used [-Wunused-const-variable=]
 static const char * const dccp_state_names[] = {

We include dccp_state_names in the macro
CONFIG_NF_CONNTRACK_PROCFS, since it is only used in the place
which is included in the macro CONFIG_NF_CONNTRACK_PROCFS.

Fixes: 2bc780499aa3 ("[NETFILTER]: nf_conntrack: add DCCP protocol support")
Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_conntrack_proto_dccp.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jakub Kicinski July 28, 2023, 3:28 a.m. UTC | #1
On Thu, 27 Jul 2023 15:35:56 +0200 Florian Westphal wrote:
> When building with W=1, the following warning occurs.
> 
> net/netfilter/nf_conntrack_proto_dccp.c:72:27: warning: ‘dccp_state_names’ defined but not used [-Wunused-const-variable=]
>  static const char * const dccp_state_names[] = {
> 
> We include dccp_state_names in the macro
> CONFIG_NF_CONNTRACK_PROCFS, since it is only used in the place
> which is included in the macro CONFIG_NF_CONNTRACK_PROCFS.

FTR I can't say I see this with the versions of gcc / clang I have :S

> Fixes: 2bc780499aa3 ("[NETFILTER]: nf_conntrack: add DCCP protocol support")

Nor that it's worth a Fixes tag?
Jakub Kicinski July 28, 2023, 3:28 a.m. UTC | #2
On Thu, 27 Jul 2023 20:28:11 -0700 Jakub Kicinski wrote:
> > We include dccp_state_names in the macro
> > CONFIG_NF_CONNTRACK_PROCFS, since it is only used in the place
> > which is included in the macro CONFIG_NF_CONNTRACK_PROCFS.  
> 
> FTR I can't say I see this with the versions of gcc / clang I have :S

Ignore. Just my stupidity.
patchwork-bot+netdevbpf@kernel.org July 28, 2023, 3:40 a.m. UTC | #3
Hello:

This series was applied to netdev/net-next.git (main)
by Florian Westphal <fw@strlen.de>:

On Thu, 27 Jul 2023 15:35:56 +0200 you wrote:
> From: Zhu Wang <wangzhu9@huawei.com>
> 
> When building with W=1, the following warning occurs.
> 
> net/netfilter/nf_conntrack_proto_dccp.c:72:27: warning: ‘dccp_state_names’ defined but not used [-Wunused-const-variable=]
>  static const char * const dccp_state_names[] = {
> 
> [...]

Here is the summary with links:
  - [net-next,1/5] nf_conntrack: fix -Wunused-const-variable=
    https://git.kernel.org/netdev/net-next/c/a927d77778e3
  - [net-next,2/5] netlink: allow be16 and be32 types in all uint policy checks
    https://git.kernel.org/netdev/net-next/c/5fac9b7c16c5
  - [net-next,3/5] netfilter: nf_tables: use NLA_POLICY_MASK to test for valid flag options
    https://git.kernel.org/netdev/net-next/c/100a11b69842
  - [net-next,4/5] netfilter: conntrack: validate cta_ip via parsing
    https://git.kernel.org/netdev/net-next/c/0c805e80e35d
  - [net-next,5/5] lib/ts_bm: add helper to reduce indentation and improve readability
    https://git.kernel.org/netdev/net-next/c/86e9c9aa2358

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/netfilter/nf_conntrack_proto_dccp.c b/net/netfilter/nf_conntrack_proto_dccp.c
index d4fd626d2b8c..e2db1f4ec2df 100644
--- a/net/netfilter/nf_conntrack_proto_dccp.c
+++ b/net/netfilter/nf_conntrack_proto_dccp.c
@@ -69,6 +69,7 @@ 
 
 #define DCCP_MSL (2 * 60 * HZ)
 
+#ifdef CONFIG_NF_CONNTRACK_PROCFS
 static const char * const dccp_state_names[] = {
 	[CT_DCCP_NONE]		= "NONE",
 	[CT_DCCP_REQUEST]	= "REQUEST",
@@ -81,6 +82,7 @@  static const char * const dccp_state_names[] = {
 	[CT_DCCP_IGNORE]	= "IGNORE",
 	[CT_DCCP_INVALID]	= "INVALID",
 };
+#endif
 
 #define sNO	CT_DCCP_NONE
 #define sRQ	CT_DCCP_REQUEST