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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 net/netfilter/nf_conntrack_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 */
-- 
2.37.4




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux