From: Sasha Levin <sashal@kernel.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Dmitry Safonov <0x7f454c46@gmail.com>,
Hangbin Liu <hangbin.liu@linux.dev>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: net: tcp_ao: don't shift a size_t by 32
Date: Thu, 5 Nov 2026 07:48:19 -0500 [thread overview]
Message-ID: <20261105124819.1532111-1-sashal@kernel.org> (raw)
In-Reply-To: <20261105110856.2dc9f08c@pumpkin>
On Thu, Nov 05, 2026 at 11:08:56AM +0000, David Laight wrote:
>On Tue, 3 Nov 2026 11:39:21 -0500
>Sasha Levin <sashal@kernel.org> wrote:
>
>> #ifdef IPV6_TEST
>> - ret.a6.s6_addr32[3] = htonl(n & (BIT(32) - 1));
>> - ret.a6.s6_addr32[2] = htonl((n >> 32) & (BIT(32) - 1));
>> + ret.a6.s6_addr32[3] = htonl((uint64_t)n & 0xffffffff);
>
>You don't need a cast or mask there.
>
>> + ret.a6.s6_addr32[2] = htonl((uint64_t)n >> 32);
>
>That can also be n >> 16 >> 16
>
>Also see upper_32_bits() and lower_32_bits() in wordpart.h
>which might not be available for selftests?
They aren't, tools/include has no copy of wordpart.h.
It works as is, but you're right, htonl(n) and htonl(n >> 16 >> 16) are enough.
Happy to respin with those if the maintainers prefer.
--
Thanks,
Sasha
prev parent reply other threads:[~2026-11-05 12:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 16:39 Sasha Levin
2026-11-04 1:42 ` Hangbin Liu
2026-11-04 13:45 ` Dmitry Safonov
2026-11-05 11:08 ` David Laight
2026-11-05 12:48 ` Sasha Levin [this message]
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=20261105124819.1532111-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=0x7f454c46@gmail.com \
--cc=davem@davemloft.net \
--cc=david.laight.linux@gmail.com \
--cc=edumazet@kernel.org \
--cc=hangbin.liu@linux.dev \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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 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®