netfilter-devel.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
Subject: [PATCH 13/47] netfilter: nf_tables: No need to check chain existence when tracing
Date: Mon,  4 Sep 2017 00:27:13 +0200	[thread overview]
Message-ID: <1504477667-12130-4-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1504477667-12130-1-git-send-email-pablo@netfilter.org>

From: Phil Sutter <phil@nwl.cc>

nft_trace_notify() is called only from __nft_trace_packet(), which
assigns its parameter 'chain' to info->chain. __nft_trace_packet() in
turn later dereferences 'chain' unconditionally, which indicates that
it's never NULL. Same does nft_do_chain(), the only user of the tracing
infrastructure. Hence it is safe to assume the check removed here is not
needed.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_tables_trace.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/net/netfilter/nf_tables_trace.c b/net/netfilter/nf_tables_trace.c
index e1b15e7a5793..0c3a0049e4aa 100644
--- a/net/netfilter/nf_tables_trace.c
+++ b/net/netfilter/nf_tables_trace.c
@@ -217,14 +217,11 @@ void nft_trace_notify(struct nft_traceinfo *info)
 	if (trace_fill_id(skb, pkt->skb))
 		goto nla_put_failure;
 
-	if (info->chain) {
-		if (nla_put_string(skb, NFTA_TRACE_CHAIN,
-				   info->chain->name))
-			goto nla_put_failure;
-		if (nla_put_string(skb, NFTA_TRACE_TABLE,
-				   info->chain->table->name))
-			goto nla_put_failure;
-	}
+	if (nla_put_string(skb, NFTA_TRACE_CHAIN, info->chain->name))
+		goto nla_put_failure;
+
+	if (nla_put_string(skb, NFTA_TRACE_TABLE, info->chain->table->name))
+		goto nla_put_failure;
 
 	if (nf_trace_fill_rule_info(skb, info))
 		goto nla_put_failure;
-- 
2.1.4



  parent reply	other threads:[~2017-09-03 22:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 22:27 [PATCH 10/47] netfilter: conntrack: destroy functions need to free queued packets Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 11/47] netfilter: nfnetlink_queue: don't queue dying conntracks to userspace Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 12/47] netfilter: nf_hook_ops structs can be const Pablo Neira Ayuso
2017-09-03 22:27 ` Pablo Neira Ayuso [this message]
2017-09-03 22:27 ` [PATCH 14/47] netlink: Introduce nla_strdup() Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 15/47] netfilter: nf_tables: Allow table names of up to 255 chars Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 16/47] netfilter: nf_tables: Allow chain name " Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 17/47] netfilter: nf_tables: Allow set names " Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 18/47] netfilter: nf_tables: Allow object " Pablo Neira Ayuso
2017-09-03 22:27 ` [PATCH 19/47] netfilter: nft_set_rbtree: use seqcount to avoid lock in most cases 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=1504477667-12130-4-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /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).