From nobody Fri Dec 26 13:38:22 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 4dd6Bk4xpnz6LbwT for ; Fri, 26 Dec 2025 13:38:22 +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 4dd6Bk4FnVz3nmR for ; Fri, 26 Dec 2025 13:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766756302; 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=jWTb2npC/+9M+fBUz7UhheYwFPCSLbsgTkj4JCMKEpU=; b=PZJLkWkU7vAXoKYj4rxN9+gzL/yvFpj+v9MSXuZLlneJSHfhdd6SsXZvoffXcaSrXBlAZP kTSZBQwCDbH/TUnsbdumPRG1s2E2stmMzO/3VwRnOmyztC0Muu0Mr2LIlFbvI/mwD1Bi9n b8zJYmSZPuqjMrtN0nXN5UCKsO1lyIMazT6bCL/Ki3XwSmaAEko7l0nydGXXJU0XH9Kn+K +Vw2KGtX/7GUFPIZs7janlZAR0Pm8/QLS5GG73aOT4vkK60XMR9HnhFOLwLomND9zzLziF 2o5YSIfhjfubIC9hdz3Sod5RATKP17h4ms6YAdQ/A2F9hY3RnccF/AYMPmyQzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766756302; 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=jWTb2npC/+9M+fBUz7UhheYwFPCSLbsgTkj4JCMKEpU=; b=mLvPoxqbt5BFd9+vv9t0LuRboNvsmP9n8C+hbHJKeCP2gm5cyBPCbNgBMWOqNuA9Gvdxc3 ZmfZQ2yH5AjcIzldLFbyOhwnSma76sbaBXUFbnt8tar69Xt769Yq1SBmNXckogBrhyczd6 djbt5FxpDWiq+TaiLoiioE7LAOm/XcIuIQHAN65ZKxPkObTPY+JiQHpNvukl7DE5v+ouyG A+7MhzPjYWUMhEu3Wzo8woPBP+xD/Zk+6rZg6Gtoxp5GriMaLdjU0fd4DMXMKmBmOpeKJ0 JXiigAm0Nr3sdVwVUfQKdBmQVzcAmpSJNUJ2MlPsUT0uw6eKDk1+Hl1z8Akh6Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766756302; a=rsa-sha256; cv=none; b=l2lIS/mM+8sstMgi29L/4jYzzLciiOYYzzWCYpV1sGH4AROfJ/5vJDySLNbC3r7PVw1OpL 8xYL5BMJysXzV3EhMmFoK3EnmZOWuUE8GLaKvyNALOFnj8XYeYSI8iUWH4GQ/+gVBpa65t VTI3HCLvTDhHxfGTvxAt1aI4ac/+MjYiT/tfEj3KdQ2hlpnqt89BfZvxqZxJZgJ7uT0sLj wKHtIyzCMJ3Qr9CcEwd2ETPESYcItcmuo7Y4CkedQJLJ7EhxexjoBZGnbqBun8ppJ31lkm eeafNRrM1QsS3DuiQdLJzckI3EWGfB8NJTLcJ4Go7sXEyU3+mQ0aQ/BYjacA4Q== 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 4dd6Bk3gzbz1Cv for ; Fri, 26 Dec 2025 13:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37cac by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 26 Dec 2025 13:38:22 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: cd880010c49a - main - 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/main X-Git-Reftype: branch X-Git-Commit: cd880010c49a5d4ec529f4204d4e88cd27727255 Auto-Submitted: auto-generated Date: Fri, 26 Dec 2025 13:38:22 +0000 Message-Id: <694e8fce.37cac.105dfcc5@gitrepo.freebsd.org> The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=cd880010c49a5d4ec529f4204d4e88cd27727255 commit cd880010c49a5d4ec529f4204d4e88cd27727255 Author: Dimitry Andric AuthorDate: 2025-12-26 13:37:47 +0000 Commit: Dimitry Andric CommitDate: 2025-12-26 13:37:53 +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 --- 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;