All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>, kernel test robot <lkp@intel.com>
Subject: [PATCH nf-next] netfilter: conntrack: add __force annotation to silence harmless warning
Date: Mon, 14 Nov 2022 11:48:41 +0100	[thread overview]
Message-ID: <20221114104841.29891-1-fw@strlen.de> (raw)

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(-)

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


             reply	other threads:[~2022-11-14 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 10:48 Florian Westphal [this message]
2022-11-15  9:47 ` [PATCH nf-next] netfilter: conntrack: add __force annotation to silence harmless warning Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114104841.29891-1-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=lkp@intel.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.