Skip to content

Commit 53e5533

Browse files
matttbekuba-moo
authored andcommitted
selftests: mptcp: connect: fix maybe-uninitialize warn
This warning can be seen with GCC 15.2: mptcp_connect.c: In function ‘main_loop’: mptcp_connect.c:1422:37: warning: ‘peer’ may be used uninitialized [-Wmaybe-uninitialized] 1422 | if (connect(fd, peer->ai_addr, peer->ai_addrlen)) | ~~~~^~~~~~~~~ mptcp_connect.c:1377:26: note: ‘peer’ was declared here 1377 | struct addrinfo *peer; | ^~~~ This variable is set in sock_connect_mptcp() in some conditions. If not, this helper returns an error, and the program stops. So this is a false positive, but better removing it by initialising peer to NULL. Reviewed-by: Geliang Tang <geliang@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260205-net-mptcp-misc-fixes-6-19-rc8-v2-4-c2720ce75c34@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 136f1e1 commit 53e5533

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/testing/selftests/net/mptcp/mptcp_connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,8 @@ void xdisconnect(int fd)
12961296

12971297
int main_loop(void)
12981298
{
1299+
struct addrinfo *peer = NULL;
12991300
int fd = 0, ret, fd_in = 0;
1300-
struct addrinfo *peer;
13011301
struct wstate winfo;
13021302

13031303
if (cfg_input && cfg_sockopt_types.mptfo) {

0 commit comments

Comments
 (0)