* [PATCH net-next] netfilter: nft_payload: Use csum_replace4() instead of opencoding
@ 2025-08-12 9:58 Christophe Leroy
2025-08-14 6:26 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Leroy @ 2025-08-12 9:58 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: Christophe Leroy, netfilter-devel, coreteam, netdev, linux-kernel
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>
---
net/netfilter/nft_payload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 7dfc5343dae46..e279b54ed7116 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, fsum, tsum);
if (*sum == 0)
*sum = CSUM_MANGLED_0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] netfilter: nft_payload: Use csum_replace4() instead of opencoding
2025-08-12 9:58 [PATCH net-next] netfilter: nft_payload: Use csum_replace4() instead of opencoding Christophe Leroy
@ 2025-08-14 6:26 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2025-08-14 6:26 UTC (permalink / raw)
To: Christophe Leroy, Pablo Neira Ayuso, Jozsef Kadlecsik,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: oe-kbuild-all, netdev, Christophe Leroy, netfilter-devel,
coreteam, linux-kernel
Hi Christophe,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/netfilter-nft_payload-Use-csum_replace4-instead-of-opencoding/20250812-183440
base: net-next/main
patch link: https://lore.kernel.org/r/e98467a942d65d2dc45dcf8ff809b43d4a3769eb.1754992552.git.christophe.leroy%40csgroup.eu
patch subject: [PATCH net-next] netfilter: nft_payload: Use csum_replace4() instead of opencoding
config: x86_64-randconfig-122-20250814 (https://download.01.org/0day-ci/archive/20250814/202508141336.K6vIBjy1-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250814/202508141336.K6vIBjy1-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508141336.K6vIBjy1-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nft_payload.c:687:28: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __be32 [usertype] from @@ got restricted __wsum [usertype] fsum @@
net/netfilter/nft_payload.c:687:28: sparse: expected restricted __be32 [usertype] from
net/netfilter/nft_payload.c:687:28: sparse: got restricted __wsum [usertype] fsum
>> net/netfilter/nft_payload.c:687:34: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __be32 [usertype] to @@ got restricted __wsum [usertype] tsum @@
net/netfilter/nft_payload.c:687:34: sparse: expected restricted __be32 [usertype] to
net/netfilter/nft_payload.c:687:34: sparse: got restricted __wsum [usertype] tsum
>> net/netfilter/nft_payload.c:687:28: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __be32 [usertype] from @@ got restricted __wsum [usertype] fsum @@
net/netfilter/nft_payload.c:687:28: sparse: expected restricted __be32 [usertype] from
net/netfilter/nft_payload.c:687:28: sparse: got restricted __wsum [usertype] fsum
>> net/netfilter/nft_payload.c:687:34: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __be32 [usertype] to @@ got restricted __wsum [usertype] tsum @@
net/netfilter/nft_payload.c:687:34: sparse: expected restricted __be32 [usertype] to
net/netfilter/nft_payload.c:687:34: sparse: got restricted __wsum [usertype] tsum
vim +687 net/netfilter/nft_payload.c
684
685 static inline void nft_csum_replace(__sum16 *sum, __wsum fsum, __wsum tsum)
686 {
> 687 csum_replace4(sum, fsum, tsum);
688 if (*sum == 0)
689 *sum = CSUM_MANGLED_0;
690 }
691
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-14 6:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 9:58 [PATCH net-next] netfilter: nft_payload: Use csum_replace4() instead of opencoding Christophe Leroy
2025-08-14 6:26 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).