]> www.infradead.org Git - nvme.git/commitdiff
selftests/tcp_ao: Zero-init tcp_ao_info_opt
authorDmitry Safonov <0x7f454c46@gmail.com>
Sat, 13 Apr 2024 01:42:53 +0000 (02:42 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 16 Apr 2024 11:35:05 +0000 (13:35 +0200)
The structure is on the stack and has to be zero-initialized as
the kernel checks for:
> if (in.reserved != 0 || in.reserved2 != 0)
> return -EINVAL;

Fixes: b26660531cf6 ("selftests/net: Add test for TCP-AO add setsockopt() command")
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/tcp_ao/setsockopt-closed.c

index 452de131fa3a9c720cd1fc4b9dc24438fd01d15d..517930f9721bd9b062d178def9fb296c17353119 100644 (file)
@@ -21,7 +21,7 @@ static void make_listen(int sk)
 static void test_vefify_ao_info(int sk, struct tcp_ao_info_opt *info,
                                const char *tst)
 {
-       struct tcp_ao_info_opt tmp;
+       struct tcp_ao_info_opt tmp = {};
        socklen_t len = sizeof(tmp);
 
        if (getsockopt(sk, IPPROTO_TCP, TCP_AO_INFO, &tmp, &len))