All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] selftests: net: reuseport_dualstack: fix uninitalized parameter
@ 2019-10-31 23:24 Wei Wang
  2019-11-01 22:11 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Wang @ 2019-10-31 23:24 UTC (permalink / raw)
  To: David Miller, netdev
  Cc: Wei Wang, Maciej Żenczykowski, Eric Dumazet, Craig Gallek

This test reports EINVAL for getsockopt(SOL_SOCKET, SO_DOMAIN)
occasionally due to the uninitialized length parameter.
Initialize it to fix this, and also use int for "test_family" to comply
with the API standard.

Fixes: d6a61f80b871 ("soreuseport: test mixed v4/v6 sockets")
Reported-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Wei Wang <weiwan@google.com>
Cc: Craig Gallek <cgallek@google.com>
---
 tools/testing/selftests/net/reuseport_dualstack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/reuseport_dualstack.c b/tools/testing/selftests/net/reuseport_dualstack.c
index fe3230c55986..fb7a59ed759e 100644
--- a/tools/testing/selftests/net/reuseport_dualstack.c
+++ b/tools/testing/selftests/net/reuseport_dualstack.c
@@ -129,7 +129,7 @@ static void test(int *rcv_fds, int count, int proto)
 {
 	struct epoll_event ev;
 	int epfd, i, test_fd;
-	uint16_t test_family;
+	int test_family;
 	socklen_t len;
 
 	epfd = epoll_create(1);
@@ -146,6 +146,7 @@ static void test(int *rcv_fds, int count, int proto)
 	send_from_v4(proto);
 
 	test_fd = receive_once(epfd, proto);
+	len = sizeof(test_family);
 	if (getsockopt(test_fd, SOL_SOCKET, SO_DOMAIN, &test_family, &len))
 		error(1, errno, "failed to read socket domain");
 	if (test_family != AF_INET)
-- 
2.24.0.rc0.303.g954a862665-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] selftests: net: reuseport_dualstack: fix uninitalized parameter
  2019-10-31 23:24 [PATCH net] selftests: net: reuseport_dualstack: fix uninitalized parameter Wei Wang
@ 2019-11-01 22:11 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-11-01 22:11 UTC (permalink / raw)
  To: weiwan; +Cc: netdev, maze, edumazet, cgallek

From: Wei Wang <weiwan@google.com>
Date: Thu, 31 Oct 2019 16:24:36 -0700

> This test reports EINVAL for getsockopt(SOL_SOCKET, SO_DOMAIN)
> occasionally due to the uninitialized length parameter.
> Initialize it to fix this, and also use int for "test_family" to comply
> with the API standard.
> 
> Fixes: d6a61f80b871 ("soreuseport: test mixed v4/v6 sockets")
> Reported-by: Maciej Żenczykowski <maze@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Wei Wang <weiwan@google.com>
> Cc: Craig Gallek <cgallek@google.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-01 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-31 23:24 [PATCH net] selftests: net: reuseport_dualstack: fix uninitalized parameter Wei Wang
2019-11-01 22:11 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.