From nobody Mon Dec 29 02:12:14 2025 X-Original-To: dev-commits-src-branches@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 4dffqf3Plmz6LVsF for ; Mon, 29 Dec 2025 02:12:14 +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 4dffqf1zr7z3hlG for ; Mon, 29 Dec 2025 02:12:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974334; 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=pV0ONvZFhQs42UUXTkEo3ptXh3N+fGarFPN+3P5KxoQ=; b=DtqC1byc6QCw4YW6nCGSPU0dYpiAhemzVqvXcbRtlIW+Oa5m65ltpEU2K+xdJ+dh+hjHt8 brfVSYNeG4oxM8wS1Fa1Y354A1Zw/74d5r8JaX/Hg5uUoKlDWmOz0OfifaAw9yrpqUFp9O zhOxYJbTDIiLhp6Xkx1woxsYclSda2obqVehirvDoZ/ioQXUgaInwGJdkLLr4bIFbAfe2a B8pO5ev5+dfDbfc9Odd91K8/9lGBDw20+u3gDCr/0CEGmubCzJ+6lh4xJbYDf1NhhDObXv qY2O8Yh70EkUvSgOuqAz7idSc0wPYYidHE1KXfpcFoUXLeHbbx3wDS7eJS5aTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766974334; 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=pV0ONvZFhQs42UUXTkEo3ptXh3N+fGarFPN+3P5KxoQ=; b=ybRQI9tP/WKiz0YUZmnqfzl+cP6llkp9M1CyjrN156AjISGgpXPsCWvznxi8xEoPZV3m7l C86dW7CfzpqG9DpzEWUFpQ3pOVGYg7iwwb9p4oMiPT0wuj/bRyjY7XlD6fLetJDfJEanU0 uaiYfenJdArOztrINOw5kq+xQVKx0ZJ27PqqlDYtkDr9ytMybppNbO2Su8cECYzaUbBHo+ aKmiKLihCjKY9xiuSKUAhc44ymAVh5nPRiqkYBl923bIcF0Nl2NbYsbk1HB2q5tsyFL8fX OyV/nW7ehIzP1q71Pp2qQ26VngH7VFJAHXNSQ8JXKHIpsBlEeRu7uKqTCXFLKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766974334; a=rsa-sha256; cv=none; b=r3rTJPhHOtCKSGDzziSqhiUp3/PjMFD0Hk87HEJq5Va0IAKXA3pPWrwDEiKT01dwDh0NUx Wc+g6CNUc/82Iupd22B3e778XPezW+1SZkZN3XSaxTxLKKSMLJQNwBt4DB8zP9EysN4ZCr 6s8LPKjQqMaXRUbdGV3juPasvUAeqA5seIe2Noqv7hPALmAC6TlC0BqRYQ8rCPcScII8j0 tgYTWfW9wnux3Sud/c1F8wwrhTxyVCQ53GtZn1/ZlrbWJhKiBq50/zKnK46SbJ85XEziRf D2YDerJcNEESaGinL2Cdb8avMY0spivz5yUySgkkp1bzeI8SdAef+XaMcEmHvw== 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 4dffqf1Ww0z19RC for ; Mon, 29 Dec 2025 02:12:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d4b8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 29 Dec 2025 02:12:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: ea9ce3875759 - stable/15 - pmcannotate: avoid accessing uninitialized local variables List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/15 X-Git-Reftype: branch X-Git-Commit: ea9ce38757594252558d27152fb7173ad1510aa7 Auto-Submitted: auto-generated Date: Mon, 29 Dec 2025 02:12:14 +0000 Message-Id: <6951e37e.3d4b8.2e9d8fa4@gitrepo.freebsd.org> The branch stable/15 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ea9ce38757594252558d27152fb7173ad1510aa7 commit ea9ce38757594252558d27152fb7173ad1510aa7 Author: Dimitry Andric AuthorDate: 2025-12-26 13:37:47 +0000 Commit: Dimitry Andric CommitDate: 2025-12-29 02:09:43 +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 5958ff615e4b..6f3e121b4729 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) @@ -702,6 +704,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;