summaryrefslogtreecommitdiff
path: root/net/netfilter
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2025-08-18 11:48:30 +0200
committerFlorian Westphal <fw@strlen.de>2025-09-02 15:28:17 +0200
commitc015e17ba111e1cd2c7180204b006266aa15c263 (patch)
tree7d847f7ccd2b644d649868f636f06d0a2b5e3d50 /net/netfilter
parent46015e6b3ea75297b28d4806564f3f692cf11861 (diff)
netfilter: nft_payload: Use csum_replace4() instead of opencoding
Open coded calculation can be avoided and replaced by the equivalent csum_replace4() in nft_csum_replace(). Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nft_payload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 7dfc5343dae4..059b28ffad0e 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -684,7 +684,7 @@ static const struct nft_expr_ops nft_payload_inner_ops = {
static inline void nft_csum_replace(__sum16 *sum, __wsum fsum, __wsum tsum)
{
- *sum = csum_fold(csum_add(csum_sub(~csum_unfold(*sum), fsum), tsum));
+ csum_replace4(sum, (__force __be32)fsum, (__force __be32)tsum);
if (*sum == 0)
*sum = CSUM_MANGLED_0;
}