From nobody Mon Dec 29 02:12:30 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dffqz2C0fz6LW7c for ; Mon, 29 Dec 2025 02:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dffqy5sWFz3jll for ; Mon, 29 Dec 2025 02:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zz7ncSqz9lIHVqwO2/bUdZ7JeP6py88N4gNEPv8SoX8=; b=iqFsk0SRfFfFMpuXSq33LIMhJaCElOiMlUZI3XGsl5JPpikmuUsNbbpAwPhPrcVZrn3RdE F79DSDQr/W9r1jkfiULe5jBBn4ceSBeTk4BXzxkymIjCl16Rs7sBrRAhS7fYFOAqq1lLk+ 7sVBydfClBrlyBYKyF8Cl8ISAxEr/LIBdq6IuzURr8sPd4KkuZ0lQZqNYhI88+w9HJe/Ew wtuqG9i1KNVfxTfxW92OtLKvS1N5Iv2Ed1Q6TY3bHJHMTBdnCdrLU3ZaKYBmW+yWPs/dgB EywI4++HE/peWduEqWFElC6sefgAIDxPr31XmuIwR3ygLzk+zhUo9uIiZFh3EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zz7ncSqz9lIHVqwO2/bUdZ7JeP6py88N4gNEPv8SoX8=; b=dG/1UApnCMAjC4eijbKNUKclB8QC/wkGz+Nuf2PIWi455tqF9vBoOZGCl6FaFjr+pQHW+b eivVFGVosHB2wGrMetMPZMtgzO0L/p1fpqyUrWfqNzvanZ3MEStPWMxMKjUFgkxT/pvt1o /bt7u3rwqWiFwCJuV6A44A46YsTBBQiBXY/qBUJJIwN8RQrX3QSFjwNIb6wEhlK8WcgqPm dVnLiG3JAPi7iPFEfi2phTTmvsB9engHdz5CU7frQDykIoSikB7HuVs65CDt3z6jcia8bw mLaV1XMRcDGdaU33LNO5lLlnlNA93A4SFau6LbGjJ6zk72d4OZ3D5HBT+rlq4Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766974350; a=rsa-sha256; cv=none; b=KTOLdgi8T0XooJjqsUVi8TU1mCqrWqch3idW1XNmLDIhzVfHAH3sqMXwtdD9HbeombLVHQ ddTWtpROK2+49qNwc6yI2XKgxZ43PVpqA+pGNfNFgUdRsMXy8vqzZCk8KespHqZo53juMp GQQrluGmq9epjDR4aiTFci69GjYkMedbmOsJvpsqoO//WmYVJzVQ9k+yk9L7H94pUaIKs6 kAhKyFNGyJtQfA9e0ADVMDQx+UFGebbImvKFDSuqrht1JC/Ye5g8BxDjYbag6XR5hGk9SL AsBjAQ3HLcWt++JPW948NIRvxF9aTB1Lxl4I41547hAx0wFPu0XFAO/+ktMY2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dffqy5GFhz19gJ for ; Mon, 29 Dec 2025 02:12:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c75a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Dec 2025 02:12:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 5143ea18e510 - stable/14 - pmcannotate: avoid accessing uninitialized local variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5143ea18e51042811bfb8be2b14e57befbde10fe Auto-Submitted: auto-generated Date: Mon, 29 Dec 2025 02:12:30 +0000 Message-Id: <6951e38e.3c75a.2237d33d@gitrepo.freebsd.org> The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=5143ea18e51042811bfb8be2b14e57befbde10fe commit 5143ea18e51042811bfb8be2b14e57befbde10fe Author: Dimitry Andric AuthorDate: 2025-12-26 13:37:47 +0000 Commit: Dimitry Andric CommitDate: 2025-12-29 02:11:35 +0000 pmcannotate: avoid accessing uninitialized local variables Initialize `tbfl` and `tofl` to NULL, and check whether they are non-NULL before calling remove(3) on them, to avoid warnings from clang 21 similar to: usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tbfl' is uninitialized when used here [-Werror,-Wuninitialized] 746 | FATAL(exec, "%s: Impossible to locate the binary file\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | exec); | ~~~~~ usr.sbin/pmcannotate/pmcannotate.c:57:9: note: expanded from macro 'FATAL' 57 | remove(tbfl); \ | ^~~~ usr.sbin/pmcannotate/pmcannotate.c:695:12: note: initialize the variable 'tbfl' to silence this warning 695 | char *tbfl, *tofl, *tmpdir; | ^ | = NULL usr.sbin/pmcannotate/pmcannotate.c:746:3: error: variable 'tofl' is uninitialized when used here [-Werror,-Wuninitialized] 746 | FATAL(exec, "%s: Impossible to locate the binary file\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 747 | exec); | ~~~~~ usr.sbin/pmcannotate/pmcannotate.c:58:9: note: expanded from macro 'FATAL' 58 | remove(tofl); \ | ^~~~ usr.sbin/pmcannotate/pmcannotate.c:695:19: note: initialize the variable 'tofl' to silence this warning 695 | char *tbfl, *tofl, *tmpdir; | ^ | = NULL MFC after: 3 days (cherry picked from commit cd880010c49a5d4ec529f4204d4e88cd27727255) --- usr.sbin/pmcannotate/pmcannotate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pmcannotate/pmcannotate.c b/usr.sbin/pmcannotate/pmcannotate.c index c00e4b2a33bc..9c11018135c3 100644 --- a/usr.sbin/pmcannotate/pmcannotate.c +++ b/usr.sbin/pmcannotate/pmcannotate.c @@ -55,8 +55,10 @@ if ((ptr) != NULL) \ perror(ptr); \ fprintf(stderr, ##x); \ - remove(tbfl); \ - remove(tofl); \ + if (tbfl != NULL) \ + remove(tbfl); \ + if (tofl != NULL) \ + remove(tofl); \ exit(EXIT_FAILURE); \ } while (0) @@ -703,6 +705,8 @@ main(int argc, char *argv[]) uintptr_t tmppc, ostart, oend; int cget, asmsrc; + tbfl = NULL; + tofl = NULL; exec = argv[0]; ofile = NULL; bin = NULL;