]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/net: Replace non-standard __WORDSIZE with sizeof(long) * 8
authorWake Liu <wakel@google.com>
Thu, 7 Aug 2025 08:09:32 +0000 (16:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2025 11:45:09 +0000 (12:45 +0100)
commit00e6691f6cfba8f0123a5adf14d6c228e897fc40
treec0cf88f4143fea2ec69bffa4e4b2bb1afc02d634
parent72ee532421e866758cb3024cb6148989979a0d27
selftests/net: Replace non-standard __WORDSIZE with sizeof(long) * 8

[ Upstream commit c36748e8733ef9c5f4cd1d7c4327994e5b88b8df ]

The `__WORDSIZE` macro, defined in the non-standard `<bits/wordsize.h>`
header, is a GNU extension and not universally available with all
toolchains, such as Clang when used with musl libc.

This can lead to build failures in environments where this header is
missing.

The intention of the code is to determine the bit width of a C `long`.
Replace the non-portable `__WORDSIZE` with the standard and portable
`sizeof(long) * 8` expression to achieve the same result.

This change also removes the inclusion of the now-unused
`<bits/wordsize.h>` header.

Signed-off-by: Wake Liu <wakel@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/psock_tpacket.c