In a few MPTCP selftest tools, gcc 12 complains that the 'sock' variable might be used uninitialized. This is a false positive because the only code path that could lead to uninitialized access is where getaddrinfo() fails, but the local xgetaddrinfo() wrapper exits if such a failure occurs. Initialize the 'sock' variable anyway to allow the tools to build with gcc 12.
Unified · Split
| @@ -265,7 +265,7 @@ static void sock_test_tcpulp(int sock, int proto, unsigned int line) · 264 unmodified lines | |||
| 265 | static int sock_listen_mptcp(const char * const listenaddr, | 265 | static int sock_listen_mptcp(const char * const listenaddr, |
| 266 | const char * const port) | 266 | const char * const port) |
| 267 | { | 267 | { |
| 268 | int sock; | 268 | int sock = -1; |
| 269 | struct addrinfo hints = { | 269 | struct addrinfo hints = { |
| 270 | .ai_protocol = IPPROTO_TCP, | 270 | .ai_protocol = IPPROTO_TCP, |
| 271 | .ai_socktype = SOCK_STREAM, | 271 | .ai_socktype = SOCK_STREAM, |
| @@ -88,7 +88,7 @@ static void xgetaddrinfo(const char *node, const char *service, · 87 unmodified lines | |||
| 88 | static int sock_listen_mptcp(const char * const listenaddr, | 88 | static int sock_listen_mptcp(const char * const listenaddr, |
| 89 | const char * const port) | 89 | const char * const port) |
| 90 | { | 90 | { |
| 91 | int sock; | 91 | int sock = -1; |
| 92 | struct addrinfo hints = { | 92 | struct addrinfo hints = { |
| 93 | .ai_protocol = IPPROTO_TCP, | 93 | .ai_protocol = IPPROTO_TCP, |
| 94 | .ai_socktype = SOCK_STREAM, | 94 | .ai_socktype = SOCK_STREAM, |
| @@ -136,7 +136,7 @@ static void xgetaddrinfo(const char *node, const char *service, · 135 unmodified lines | |||
| 136 | static int sock_listen_mptcp(const char * const listenaddr, | 136 | static int sock_listen_mptcp(const char * const listenaddr, |
| 137 | const char * const port) | 137 | const char * const port) |
| 138 | { | 138 | { |
| 139 | int sock; | 139 | int sock = -1; |
| 140 | struct addrinfo hints = { | 140 | struct addrinfo hints = { |
| 141 | .ai_protocol = IPPROTO_TCP, | 141 | .ai_protocol = IPPROTO_TCP, |
| 142 | .ai_socktype = SOCK_STREAM, | 142 | .ai_socktype = SOCK_STREAM, |