From: Ujwal Kundur <ujwal.kundur@gmail.com>
To: allison.henderson@oracle.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
Ujwal Kundur <ujwal.kundur@gmail.com>
Subject: [PATCH net-next v2 2/4] rds: Fix endianness annotation of jhash wrappers
Date: Wed, 20 Aug 2025 23:25:48 +0530 [thread overview]
Message-ID: <20250820175550.498-3-ujwal.kundur@gmail.com> (raw)
In-Reply-To: <20250820175550.498-1-ujwal.kundur@gmail.com>
__ipv6_addr_jhash (wrapper around jhash2()) and __inet_ehashfn (wrapper
around jhash_3words()) work with u32 (host endian) values but accept big
endian inputs. Declare the local variables as big endian to avoid
unnecessary casts.
Flagged by Sparse.
Signed-off-by: Ujwal Kundur <ujwal.kundur@gmail.com>
---
net/rds/connection.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/net/rds/connection.c b/net/rds/connection.c
index d62f486ab29f..ba6fb87647ac 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -57,16 +57,17 @@ static struct hlist_head *rds_conn_bucket(const struct in6_addr *laddr,
static u32 rds6_hash_secret __read_mostly;
static u32 rds_hash_secret __read_mostly;
- u32 lhash, fhash, hash;
+ u32 hash;
+ __be32 lhash, fhash;
net_get_random_once(&rds_hash_secret, sizeof(rds_hash_secret));
net_get_random_once(&rds6_hash_secret, sizeof(rds6_hash_secret));
- lhash = (__force u32)laddr->s6_addr32[3];
+ lhash = laddr->s6_addr32[3];
#if IS_ENABLED(CONFIG_IPV6)
- fhash = __ipv6_addr_jhash(faddr, rds6_hash_secret);
+ fhash = (__force __be32)__ipv6_addr_jhash(faddr, rds6_hash_secret);
#else
- fhash = (__force u32)faddr->s6_addr32[3];
+ fhash = faddr->s6_addr32[3];
#endif
hash = __inet_ehashfn(lhash, 0, fhash, 0, rds_hash_secret);
--
2.30.2
next prev parent reply other threads:[~2025-08-20 17:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 17:55 [PATCH net-next v2 0/4] rds: Fix semantic annotations Ujwal Kundur
2025-08-20 17:55 ` [PATCH net-next v2 1/4] rds: Replace POLLERR with EPOLLERR Ujwal Kundur
2025-08-22 0:56 ` Allison Henderson
2025-08-20 17:55 ` Ujwal Kundur [this message]
2025-08-22 0:56 ` [PATCH net-next v2 2/4] rds: Fix endianness annotation of jhash wrappers Allison Henderson
2025-08-20 17:55 ` [PATCH net-next v2 3/4] rds: Fix endianness annotation for RDS_MPATH_HASH Ujwal Kundur
2025-08-22 0:56 ` Allison Henderson
2025-08-20 17:55 ` [PATCH net-next v2 4/4] rds: Fix endianness annotations for RDS extension headers Ujwal Kundur
2025-08-22 0:56 ` Allison Henderson
2025-08-22 23:50 ` [PATCH net-next v2 0/4] rds: Fix semantic annotations patchwork-bot+netdevbpf
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=20250820175550.498-3-ujwal.kundur@gmail.com \
--to=ujwal.kundur@gmail.com \
--cc=allison.henderson@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®