diff mbox series

[nf-next] netfilter: conntrack: add __force annotation to silence harmless warning

Message ID 20221114104841.29891-1-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf-next] netfilter: conntrack: add __force annotation to silence harmless warning | expand

Commit Message

Florian Westphal Nov. 14, 2022, 10:48 a.m. UTC
nf_conntrack_core.c:222:14: sparse: cast from restricted __be16
nf_conntrack_core.c:222:55: sparse: restricted __be16 degrades to integer

no need to convert anything, just add __force to silence the warning.

Fixes: 21a92d58de4e ("netfilter: conntrack: use siphash_4u64")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_conntrack_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Pablo Neira Ayuso Nov. 15, 2022, 9:47 a.m. UTC | #1
On Mon, Nov 14, 2022 at 11:48:41AM +0100, Florian Westphal wrote:
> nf_conntrack_core.c:222:14: sparse: cast from restricted __be16
> nf_conntrack_core.c:222:55: sparse: restricted __be16 degrades to integer
> 
> no need to convert anything, just add __force to silence the warning.

Squashed into original patch, thanks
diff mbox series

Patch

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index d633ef028a3d..057ebdcc25d7 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -219,7 +219,9 @@  static u32 hash_conntrack_raw(const struct nf_conntrack_tuple *tuple,
 	a = (u64)tuple->src.u3.all[0] << 32 | tuple->src.u3.all[3];
 	b = (u64)tuple->dst.u3.all[0] << 32 | tuple->dst.u3.all[3];
 
-	c = (u64)tuple->src.u.all << 32 | tuple->dst.u.all << 16 | tuple->dst.protonum;
+	c = (__force u64)tuple->src.u.all << 32 | (__force u64)tuple->dst.u.all << 16;
+	c |= tuple->dst.protonum;
+
 	d = (u64)zoneid << 32 | net_hash_mix(net);
 
 	/* IPv4: u3.all[1,2,3] == 0 */