From: Allison Henderson <allison.henderson@oracle.com>
To: "horms@kernel.org" <horms@kernel.org>,
"ujwal.kundur@gmail.com" <ujwal.kundur@gmail.com>,
"edumazet@google.com" <edumazet@google.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>
Cc: "rds-devel@oss.oracle.com" <rds-devel@oss.oracle.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2 2/4] rds: Fix endianness annotation of jhash wrappers
Date: Fri, 22 Aug 2025 00:56:16 +0000 [thread overview]
Message-ID: <ef1242e4513f700795055cd50763576511e51920.camel@oracle.com> (raw)
In-Reply-To: <20250820175550.498-3-ujwal.kundur@gmail.com>
On Wed, 2025-08-20 at 23:25 +0530, Ujwal Kundur wrote:
> __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>
This looks ok now. Thank you!
Reviewed-by: Allison Henderson <allison.henderson@oracle.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);
>
next prev parent reply other threads:[~2025-08-22 1:05 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 ` [PATCH net-next v2 2/4] rds: Fix endianness annotation of jhash wrappers Ujwal Kundur
2025-08-22 0:56 ` Allison Henderson [this message]
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=ef1242e4513f700795055cd50763576511e51920.camel@oracle.com \
--to=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 \
--cc=ujwal.kundur@gmail.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;
as well as URLs for NNTP newsgroup(s).