On Thu, Jul 11, 2024 at 8:16 PM John Hubbard jhubbard@nvidia.com wrote:
On 7/11/24 8:31 AM, Ignat Korchagin wrote:
Hi,
On 9 Jul 2024, at 12:09, Greg Kroah-Hartman gregkh@linuxfoundation.org wrote:
6.6-stable review patch. If anyone has any objections, please let me know.
From: John Hubbard jhubbard@nvidia.com
[ Upstream commit eb709b5f6536636dfb87b85ded0b2af9bb6cd9e6 ]
When building with clang, via:
make LLVM=1 -C tools/testing/selftest
...clang warns about three variables that are not initialized in all cases:
- The opt_ipproto_off variable is used uninitialized if "testname" is
not "ip". Willem de Bruijn pointed out that this is an actual bug, and suggested the fix that I'm using here (thanks!).
The addr_len is used uninitialized, but only in the assert case, which bails out, so this is harmless.
The family variable in add_listener() is only used uninitialized in the error case (neither IPv4 nor IPv6 is specified), so it's also harmless.
Fix by initializing each variable.
Signed-off-by: John Hubbard jhubbard@nvidia.com Reviewed-by: Willem de Bruijn willemb@google.com Acked-by: Mat Martineau martineau@kernel.org Link: https://lore.kernel.org/r/20240506190204.28497-1-jhubbard@nvidia.com Signed-off-by: Jakub Kicinski kuba@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org
tools/testing/selftests/net/gro.c | 3 +++ tools/testing/selftests/net/ip_local_port_range.c | 2 +- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c index 30024d0ed3739..b204df4f33322 100644 --- a/tools/testing/selftests/net/gro.c +++ b/tools/testing/selftests/net/gro.c @@ -113,6 +113,9 @@ static void setup_sock_filter(int fd) next_off = offsetof(struct ipv6hdr, nexthdr); ipproto_off = ETH_HLEN + next_off;
- /* Overridden later if exthdrs are used: */
- opt_ipproto_off = ipproto_off;
This breaks selftest compilation on 6.6, because opt_ipproto_off is not defined in the first place in 6.6
Let's just drop this patch for 6.6, then. Thanks for noticing and analyzing, Ignat!
We noticed on 6.6 because we run some selftests for this stable branch, but by the looks of it the patch needs 4e321d590cec ("selftests/net: fix GRO coalesce test and add ext header coalesce tests") so it will be broken for every stable release below 6.8
Ignat
thanks,
John Hubbard NVIDIA
if (strcmp(testname, "ip") == 0) { if (proto == PF_INET) optlen = sizeof(struct ip_timestamp); diff --git a/tools/testing/selftests/net/ip_local_port_range.c b/tools/testing/selftests/net/ip_local_port_range.c index 75e3fdacdf735..2465ff5bb3a8e 100644 --- a/tools/testing/selftests/net/ip_local_port_range.c +++ b/tools/testing/selftests/net/ip_local_port_range.c @@ -343,7 +343,7 @@ TEST_F(ip_local_port_range, late_bind) struct sockaddr_in v4; struct sockaddr_in6 v6; } addr;
- socklen_t addr_len;
- socklen_t addr_len = 0;
const int one = 1; int fd, err; __u32 range; diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 49369c4a5f261..763402dd17742 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -1239,7 +1239,7 @@ int add_listener(int argc, char *argv[]) struct sockaddr_storage addr; struct sockaddr_in6 *a6; struct sockaddr_in *a4;
- u_int16_t family;
- u_int16_t family = AF_UNSPEC;
int enable = 1; int sock; int err; -- 2.43.0
Ignat