]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
netfilter: nf_tables: No need to check chain existence when tracing
authorPhil Sutter <phil@nwl.cc>
Thu, 27 Jul 2017 14:56:39 +0000 (16:56 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 31 Jul 2017 17:14:05 +0000 (19:14 +0200)
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

index e1b15e7a5793f6b877f63a95dc20ce2626caf7f5..0c3a0049e4aa2b9a325f756e5e7a100132378288 100644 (file)
@@ -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;