Skip to content

Commit 0a3b174

Browse files
tracywwnjgregkh
authored andcommitted
selftests: net: reuseport_dualstack: fix uninitalized parameter
[ Upstream commit d64479a ] 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: d6a61f8 ("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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 46c2e4f commit 0a3b174

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎tools/testing/selftests/net/reuseport_dualstack.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void test(int *rcv_fds, int count, int proto)
129129
{
130130
struct epoll_event ev;
131131
int epfd, i, test_fd;
132-
uint16_t test_family;
132+
int test_family;
133133
socklen_t len;
134134

135135
epfd = epoll_create(1);
@@ -146,6 +146,7 @@ static void test(int *rcv_fds, int count, int proto)
146146
send_from_v4(proto);
147147

148148
test_fd = receive_once(epfd, proto);
149+
len = sizeof(test_family);
149150
if (getsockopt(test_fd, SOL_SOCKET, SO_DOMAIN, &test_family, &len))
150151
error(1, errno, "failed to read socket domain");
151152
if (test_family != AF_INET)

0 commit comments

Comments
 (0)