Skip to contentSkip to conversation

netfilter: Remove redundant NFCT_ALIGN call

PATCH Applied Xuanqiang Luo 3 participants 3 messages Apr 4, 2025 – Apr 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: Remove redundant NFCT_ALIGN call

From: Xuanqiang Luo <[email protected]>

The "nf_ct_tmpl_alloc" function had a redundant call to "NFCT_ALIGN" when aligning the pointer "p". Since "NFCT_ALIGN" always gives the same result for the same input.

---
 net/netfilter/nf_conntrack_core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/netfilter/nf_conntrack_core.c +1 -3
index 7f8b245e287a..de8d50af9b5b 100644
@@ -531,10 +531,8 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net,
 
 		p = tmpl;
 		tmpl = (struct nf_conn *)NFCT_ALIGN((unsigned long)p);
-		if (tmpl != p) {
-			tmpl = (struct nf_conn *)NFCT_ALIGN((unsigned long)p);
+		if (tmpl != p)
 			tmpl->proto.tmpl_padto = (char *)tmpl - (char *)p;
-		}
 	} else {
 		tmpl = kzalloc(sizeof(*tmpl), flags);
 		if (!tmpl)
Signature · 1 line
2.27.0
maintainer Applied
#2 lore raw
In reply to Xuanqiang Luo
Quoted 5 lines · Xuanqiang Luo

From: Xuanqiang Luo <[email protected]>

The "nf_ct_tmpl_alloc" function had a redundant call to "NFCT_ALIGN" when aligning the pointer "p". Since "NFCT_ALIGN" always gives the same result for the same input.

Applied to nf-next, thanks