Skip to content

Commit

Permalink
netfilter: nf_tables: No need to check chain existence when tracing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Phil Sutter authored and ummakynes committed Jul 31, 2017
1 parent 591bb27 commit 6e69267
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions net/netfilter/nf_tables_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6e69267

Please sign in to comment.