From nobody Wed Dec 17 10:45:15 2025 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1DFD30C627 for ; Mon, 29 Sep 2025 16:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759161795; cv=none; b=YdiQyeUYtJrVKiEi20KMZ9SVde3GgT7t0ytxORhtGz9N/EmE978eoajGZh1UGCOMqACGWExjuhhxdSVuqXBiUHu+byhG9VIgbtfmnWprff8zp1xwkwSxNI6yV+y9YcdkmKfvmDp616viWdxvX2zunkhV0q8zNAE3x6pyEdq1M4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759161795; c=relaxed/simple; bh=1jkw+7EvuIa/Han8qcxFLmMTXaJYMq7ZJC5YxwM3xL0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HvjU8ZKBCmj5wJG7uxMKy+aCgeABsh8WfmAAlNX9jp8Dl3Xc61g+nMn//BETugg+JUElFbsDb1OnYJCtys6KdTZF2AhMgW9Hx5RDmztOFAY2HAHMcNBrfoIhEkKf4Chw8To/+Dtxz8YIwR+3tFi6wLcyZDZcRjCZaf2rYwDjD5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WIEdNKCJ; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WIEdNKCJ" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-78104c8cbb4so4975049b3a.0 for ; Mon, 29 Sep 2025 09:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759161793; x=1759766593; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KefHEpASHlImKTlDtTejqsu/vtIp51mWF2HZGf1Fkyo=; b=WIEdNKCJukuVi1h9DOdGQ8/Muw/4sk1r+sFqcwhZkzSs/T7nS0Z5rIDRn0aJ6QR4nD L/ujvWnbM0exKAO889chaTUy8tlRN6IsN3nWEnANfXUV0O+wt6pJH7+L7wjJKiVQxVEV etiSJTLGdU3bIKYBrO5CitRoAZ+zhm9sET7i9OoMMxIkzQ31xC+s3zWMH3SZgFr6yhnn RkNGWUtxM1lrAPY8Rc4pCk6z/GF8x4C2rrkOyin9DU+vHh+X0hNrVbpVkV2oNWC4WeYS 7cxdtiNjT0m1NveXp8MgDzScEXYM3IQEuAjTCdAtwFxaQmZlEWn8XD+AV4r+J20HiGYg NOcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759161793; x=1759766593; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KefHEpASHlImKTlDtTejqsu/vtIp51mWF2HZGf1Fkyo=; b=IUAUrWuY7Bpfx6mGV45R/6qmwNMDEUq/K3Um0GZuge/waW2o9Jy+7e2mtLtEXI2IC5 vPWRdSh2ix3VD6B3Qy36bZBa8UMf0bo7sENq+UmSZ6obPKB969kwRFqajQy8MJUVafXr ED+vnj0FVOfPuk+ucg+5FheKJGHtuH9bVNt3j629Ne+VwfI58Wzu/xdVrnjqKJj/lM7w n3hevRaMsADmPkbfQilClQ04J5E2QyF2B8lL6nE5NrLvPfG5VRvWQlr0FKHGIiSoIZBI YB9S1t3WUR4NHsszq2Ahbtxm+dRcWMhjTPp7sLtnbhnDwRqdq2cldOOSBId/4gdypBkm qRqQ== X-Forwarded-Encrypted: i=1; AJvYcCUPNL5NgeTqEAU6UjTCWRQk1fyUewNaZlipi3XpHokQj1jV6hfRogi3Nj1HpxZk2Lh6KUHgsCtFGfHTx8M=@vger.kernel.org X-Gm-Message-State: AOJu0Yw44xDa3s7Dn/p57ycd9MYe62yXNgvAi7dRZQ4eulCbjJIHMPc8 GqBwJAonoYYnA8PN9RG90exh8nYug6tFx1dZO/bpGw4qYDuW5J5Aw1xM X-Gm-Gg: ASbGnctVkXaeYUYSQOPUXCaLz+cidQmiapVrtcclcLfW2h1eOP3yEXlzwwVnWQBTl8I Oe3smDflZimY97/0Rje14LILyCtt0EDCGyb37/ltxtmDxTOZXos97AhZR0FUZYnTn7yKtaoEQLe Seppppr2av6N1n1IRZCnx5uX4tRJG9KU7Af0NL/ljOciJ6XpcA1CU57GzC3n6uvw1FMcPYdqqVf b/ZAmzfvzXG917xjQjg8vat+MTzSkfWz7ACQJEy0zy8RgJgQIJaKzOpLvb6VXJXqUl5LN+VwXGc odCajw45EYzvJ5bjOboyzZ5+LhDhV3RO72wUkkj/BeNs9SRWzyedOKRANn0sRrKwPtyjQqGIGMk xi/vtAUyYvc+EIWv5ba2HPC0lpeEZ X-Google-Smtp-Source: AGHT+IFLs3m9GZxE68Q18gbvy+0afYHaST+CDXcgc2TlSHRuYVzEECyokcNZHk3sUQVFmBJDY053zw== X-Received: by 2002:a05:6a20:9150:b0:248:4d59:93d5 with SMTP id adf61e73a8af0-2e7d72637famr22343288637.55.1759161792642; Mon, 29 Sep 2025 09:03:12 -0700 (PDT) Received: from y740.local ([2401:4900:1f30:25ff:36cb:10ee:ba03:839f]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b57c55a0ca2sm11504525a12.42.2025.09.29.09.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Sep 2025 09:03:12 -0700 (PDT) From: Sidharth Seela To: antonio@openvpn.net, sd@queasysnail.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, willemdebruijn.kernel@gmail.com, kernelxing@tencent.com, nathan@kernel.org, nick.desaulniers+lkml@gmail.com, morbo@google.com, justinstitt@google.com Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, david.hunter.linux@gmail.com, Sidharth Seela Subject: [PATCH v2] net: Fix uninit character pointer and return values Date: Mon, 29 Sep 2025 21:32:31 +0530 Message-ID: <20250929160230.36941-2-sidharthseela@gmail.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix uninitialized character pointer, and functions that return undefined values. These issues were caught by running clang using LLVM=3D1 option; and are as follows: -- ovpn-cli.c:1587:6: warning: variable 'ret' is used uninitialized whenever '= if' condition is true [-Wsometimes-uninitialized] 1587 | if (!sock) { | ^~~~~ ovpn-cli.c:1635:9: note: uninitialized use occurs here 1635 | return ret; | ^~~ ovpn-cli.c:1587:2: note: remove the 'if' if its condition is always false 1587 | if (!sock) { | ^~~~~~~~~~~~ 1588 | fprintf(stderr, "cannot allocate netlink socket\n"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1589 | goto err_free; | ~~~~~~~~~~~~~~ 1590 | } | ~ ovpn-cli.c:1584:15: note: initialize the variable 'ret' to silence this war= ning 1584 | int mcid, ret; | ^ | =3D 0 ovpn-cli.c:2107:7: warning: variable 'ret' is used uninitialized whenever s= witch case is taken [-Wsometimes-uninitialized] 2107 | case CMD_INVALID: | ^~~~~~~~~~~ ovpn-cli.c:2111:9: note: uninitialized use occurs here 2111 | return ret; | ^~~ ovpn-cli.c:1939:12: note: initialize the variable 'ret' to silence this war= ning 1939 | int n, ret; | ^ | -- so_txtime.c:210:3: warning: variable 'reason' is used uninitialized wheneve= r switch default is taken [-Wsometimes-uninitialized] 210 | default: | ^~~~~~~ so_txtime.c:219:27: note: uninitialized use occurs here 219 | data[ret - 1], tstamp, reason); | ^~~~~~ so_txtime.c:177:21: note: initialize the variable 'reason' to silence this = warning 177 | const char *reason; | ^ | -- Fixes: 959bc330a439 ("testing/selftests: add test tool and scripts for ovpn= module") ovpn module") Fixes: ca8826095e4d4 ("selftests/net: report etf errors correctly") Signed-off-by: Sidharth Seela v2: - Use subsystem name "net". - Add fixes tags. - Remove txtimestamp fix as default case calls error. - Assign constant error string instead of NULL. -- diff --git a/tools/testing/selftests/net/ovpn/ovpn-cli.c b/tools/testing/se= lftests/net/ovpn/ovpn-cli.c index 9201f2905f2c..20d00378f34a 100644 --- a/tools/testing/selftests/net/ovpn/ovpn-cli.c +++ b/tools/testing/selftests/net/ovpn/ovpn-cli.c @@ -1581,7 +1581,7 @@ static int ovpn_listen_mcast(void) { struct nl_sock *sock; struct nl_cb *cb; - int mcid, ret; + int mcid, ret =3D -1; =20 sock =3D nl_socket_alloc(); if (!sock) { @@ -1936,7 +1936,7 @@ static int ovpn_run_cmd(struct ovpn_ctx *ovpn) { char peer_id[10], vpnip[INET6_ADDRSTRLEN], laddr[128], lport[10]; char raddr[128], rport[10]; - int n, ret; + int n, ret =3D -1; FILE *fp; =20 switch (ovpn->cmd) { diff --git a/tools/testing/selftests/net/so_txtime.c b/tools/testing/selfte= sts/net/so_txtime.c index 8457b7ccbc09..5bf3c483069b 100644 --- a/tools/testing/selftests/net/so_txtime.c +++ b/tools/testing/selftests/net/so_txtime.c @@ -174,7 +174,7 @@ static int do_recv_errqueue_timeout(int fdt) msg.msg_controllen =3D sizeof(control); =20 while (1) { - const char *reason; + const char *reason =3D "unknown errno"; =20 ret =3D recvmsg(fdt, &msg, MSG_ERRQUEUE); if (ret =3D=3D -1 && errno =3D=3D EAGAIN) --=20 2.47.3