Skip to contentSkip to conversation

netfilter: nf_tables: remove nft_dereference()

PATCH New Pablo Neira Ayuso 1 participant 1 message Dec 30, 2017

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: remove nft_dereference()

This macro is unnecessary, it just hides details for one single caller. nfnl_dereference() is just enough.

---
 include/net/netfilter/nf_tables.h | 3 ---
 net/netfilter/nf_tables_api.c     | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)
include/net/netfilter/nf_tables.h +0 -3
index 730f2898ef66..2e907f695828 100644
@@ -1092,9 +1092,6 @@ void nft_trace_notify(struct nft_traceinfo *info);
 int nf_tables_filter_init(void);
 void nf_tables_filter_fini(void);
 
-#define nft_dereference(p)					\
-	nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)
-
 #define MODULE_ALIAS_NFT_CHAIN(family, name) \
 	MODULE_ALIAS("nft-chain-" __stringify(family) "-" name)
 
net/netfilter/nf_tables_api.c +3 -3
index c6289404207b..903fb9bd0147 100644
@@ -1115,13 +1115,13 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
 static void nft_chain_stats_replace(struct nft_base_chain *chain,
 				    struct nft_stats __percpu *newstats)
 {
+	struct nft_stats __percpu *oldstats;
+
 	if (newstats == NULL)
 		return;
 
 	if (chain->stats) {
-		struct nft_stats __percpu *oldstats =
-				nft_dereference(chain->stats);
-
+		oldstats = nfnl_dereference(chain->stats, NFNL_SUBSYS_NFTABLES);
 		rcu_assign_pointer(chain->stats, newstats);
 		synchronize_rcu();
 		free_percpu(oldstats);
Signature · 1 line
2.11.0