Skip to content

Commit 6e69267

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: nf_tables: No need to check chain existence when tracing
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>
1 parent 591bb27 commit 6e69267

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

net/netfilter/nf_tables_trace.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,11 @@ void nft_trace_notify(struct nft_traceinfo *info)
217217
if (trace_fill_id(skb, pkt->skb))
218218
goto nla_put_failure;
219219

220-
if (info->chain) {
221-
if (nla_put_string(skb, NFTA_TRACE_CHAIN,
222-
info->chain->name))
223-
goto nla_put_failure;
224-
if (nla_put_string(skb, NFTA_TRACE_TABLE,
225-
info->chain->table->name))
226-
goto nla_put_failure;
227-
}
220+
if (nla_put_string(skb, NFTA_TRACE_CHAIN, info->chain->name))
221+
goto nla_put_failure;
222+
223+
if (nla_put_string(skb, NFTA_TRACE_TABLE, info->chain->table->name))
224+
goto nla_put_failure;
228225

229226
if (nf_trace_fill_rule_info(skb, info))
230227
goto nla_put_failure;

0 commit comments

Comments
 (0)