From nobody Mon Dec 29 02:13:12 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 4dffrn1mrrz6LW7m for ; Mon, 29 Dec 2025 02:13:13 +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 4dffrm6mVbz3l89 for ; Mon, 29 Dec 2025 02:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974393; 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=aCQa5a/+nsTmv9Mdszu5lbNsQae1kqZuL5E/7fXpBTA=; b=G+Y27S5qF5VYb2tQMQK2w4wfA5hCcOtBnvkqty3e7c3RXlC59CgQ4EIMieoM4nphPudNou HvK7u2xpxuiVT4rFoiFJY8JabxRT32+3ICEoMNR2mHX9L0x218h/hqPKvfao9JiGYdw97y 3npX2h0Cx1juTd4Kvs5SGfDa9kDpLBhXLeaHTl3g2S1NdOwzhUfaaOjHuyUx2kX1spSdh3 7QTC+ay8+sZa6nqu+mGGAEnSHdqk+BZYXJB0vfqTR/NbaMHXH2wvWjcGhamE6vjKu27lRo ZtiPJL0GZ5itbcofWVkcCHurBt7PMKbCu+42Bd4rHoGVePdQn7xByRuDzCUe6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974392; 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=aCQa5a/+nsTmv9Mdszu5lbNsQae1kqZuL5E/7fXpBTA=; b=t2b/inryg9spMwgOIW9/aQfZwJYSu4NwEDjDiJdx7Jo6iOsWB5Y7T9667Ktj9AILXw3jgu IaeApvajD67QhXgTcvjeyzt89n8WNxnhJPy9CH7IGLuIJnyGRAjO7vzSGdq/z2nhzN/Cpj NR52CGf5MPLdt7yxv5QtNjRZRM5s8lSCPutZ7deyCqb+LzmZHYIygGr6+bk/AmD4/VYvEQ LZ5rWHUNImWsssbQRNKcTIHCOwybaLyiWP9GXUk+9SkBQIbl8Mtq2I5j7OIAHBY3KEpQNr 55s7nDK5aZdVAlJLDuzwpZlvGxF+kdHw0v2x1FoeXZYgQld3lwDSbpyr0AUteA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766974392; a=rsa-sha256; cv=none; b=wul9jMhERJzjfvKymwo5pVP0bi1PgFex8zwIp/YTbNa+VKYN+eQB+sBA0uF7spKJ3/vdke k5cS+MK/nfPm7hz4jqNeTfM/oyPnr3Cz3z+dBoxctBynIv048csiV2zLwMAixR8/UoTAR9 D/KTKxu4nXyaz4qQWWhixbNR3dnSABt015zjyY1lUFHMHTB4mkweuX3DgnC8ca/IArBj0n T29VfzcINTxXyjc5ccYXwT95ToQeM8TRz3KkPHc6/d1GjXQssKQ63VUMbdl3WNKEuMOJ5z g98fadu8fqtj8ofTfBlmOAMDySMlFU0d9rW47lTPSJIXQnPFab9TwWadtM0pKw== 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 4dffrm614Rz19RM for ; Mon, 29 Dec 2025 02:13:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d4bc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Dec 2025 02:13:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 14ab9445f714 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 14ab9445f71454c21620f9a7f69352bea1349779 Auto-Submitted: auto-generated Date: Mon, 29 Dec 2025 02:13:12 +0000 Message-Id: <6951e3b8.3d4bc.7bfae91a@gitrepo.freebsd.org> The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=14ab9445f71454c21620f9a7f69352bea1349779 commit 14ab9445f71454c21620f9a7f69352bea1349779 Author: Dimitry Andric AuthorDate: 2025-12-26 13:37:47 +0000 Commit: Dimitry Andric CommitDate: 2025-12-29 02:11:58 +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 32138aa6c3a7..0044f6aa7d9e 100644 --- a/usr.sbin/pmcannotate/pmcannotate.c +++ b/usr.sbin/pmcannotate/pmcannotate.c @@ -54,8 +54,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) @@ -676,6 +678,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;