netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, fw@strlen.de,
	horms@kernel.org
Subject: [PATCH net 6/7] netfilter: conntrack: clean up returns in nf_conntrack_log_invalid_sysctl()
Date: Thu,  7 Aug 2025 13:29:47 +0200	[thread overview]
Message-ID: <20250807112948.1400523-7-pablo@netfilter.org> (raw)
In-Reply-To: <20250807112948.1400523-1-pablo@netfilter.org>

From: Dan Carpenter <dan.carpenter@linaro.org>

Smatch complains that these look like error paths with missing error
codes, especially the one where we return if nf_log_is_registered() is
true:

    net/netfilter/nf_conntrack_standalone.c:575 nf_conntrack_log_invalid_sysctl()
    warn: missing error code? 'ret'

In fact, all these return zero deliberately.  Change them to return a
literal instead which helps readability as well as silencing the warning.

Fixes: e89a68046687 ("netfilter: load nf_log_syslog on enabling nf_conntrack_log_invalid")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Lance Yang <lance.yang@linux.dev>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_standalone.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 9b8b10a85233..1f14ef0436c6 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -567,16 +567,16 @@ nf_conntrack_log_invalid_sysctl(const struct ctl_table *table, int write,
 		return ret;
 
 	if (*(u8 *)table->data == 0)
-		return ret;
+		return 0;
 
 	/* Load nf_log_syslog only if no logger is currently registered */
 	for (i = 0; i < NFPROTO_NUMPROTO; i++) {
 		if (nf_log_is_registered(i))
-			return ret;
+			return 0;
 	}
 	request_module("%s", "nf_log_syslog");
 
-	return ret;
+	return 0;
 }
 
 static struct ctl_table_header *nf_ct_netfilter_header;
-- 
2.30.2


  parent reply	other threads:[~2025-08-07 11:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 11:29 [PATCH net 0/7] Netfilter fixes for net Pablo Neira Ayuso
2025-08-07 11:29 ` [PATCH net 1/7] MAINTAINERS: resurrect my netfilter maintainer entry Pablo Neira Ayuso
2025-08-07 11:35   ` Eric Dumazet
2025-08-07 18:24     ` Simon Horman
2025-08-10 20:08       ` Antonio Ojea
2025-08-08 18:50   ` patchwork-bot+netdevbpf
2025-08-07 11:29 ` [PATCH net 2/7] netfilter: add back NETFILTER_XTABLES dependencies Pablo Neira Ayuso
2025-08-07 11:29 ` [PATCH net 3/7] netfilter: ctnetlink: fix refcount leak on table dump Pablo Neira Ayuso
2025-08-07 11:29 ` [PATCH net 4/7] netfilter: ctnetlink: remove refcounting in expectation dumpers Pablo Neira Ayuso
2025-08-07 11:29 ` [PATCH net 5/7] netfilter: nft_set_pipapo: don't return bogus extension pointer Pablo Neira Ayuso
2025-08-07 11:29 ` Pablo Neira Ayuso [this message]
2025-08-07 11:29 ` [PATCH net 7/7] netfilter: nft_socket: remove WARN_ON_ONCE with huge level value Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250807112948.1400523-7-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).