Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2952851lqz; Wed, 3 Apr 2024 13:27:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUK0SKryY6+F8krrodjxA2Jjzw8PYwzPlO27y2DF+a9kJDiJ0y0C/RneMw4XVueYnSJaOpHmFkdVQfa2368Eo5r/r3k2Sbxv1Q1DnriLg== X-Google-Smtp-Source: AGHT+IHykVg2TXN2IJqerbcxIoQ0237zKDnxR7fUHWDjtqQu4NIiIovhYI2n+O1xO0+d4t1MCUIn X-Received: by 2002:a05:6e02:18c5:b0:369:f750:5bfc with SMTP id s5-20020a056e0218c500b00369f7505bfcmr746276ilu.22.1712176051937; Wed, 03 Apr 2024 13:27:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712176051; cv=pass; d=google.com; s=arc-20160816; b=VqXOurWg7FT74NeTpIwg89CRxwTfAfIVqZ9dgRFWUkqMJBQB/vkrLXWxFTxaoaTt2v KNmkZE38jQFqNMkSFajsDeCWjpHvD1rUXJ9VnySYWgIMUCT83bO6Jq+nDklx6Gn4FPFx FCrXh/yngi9BusW4IKLbt3jM01gZTFsS1rUU7hLt01/jz9Cc0YfDUckO6M1HrqWql4Vr 9y0byoq/LleQkoRdq+Nlvr1sFdhfuWmo1D3HGFezCms7OCM2dk0WcMcxHouJus+IwCJn d73/CAemSW64P0bOya1HwCmSUB3lGd8OstPSY+iNbq0kmgYvbWbCkJq/9B8o3TV0v0K8 CtHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=E1dujVV93gYWo1KUE8hIXU197sdt8+aosuZKMHL/BaM=; fh=la08EwUvyn83Y6ToWrYkgGtLedsPXp+vdSO/tzuTDaI=; b=ZAZ1NDbjeQl/PDLPjqOLSFxEyhUOjqaQYLK+IzW9eSGIknCse614w6lbkgHzcKRWtH 9g3b/i0onBu2c1mCNIqNi6TzLlU+Y0pwJj53LJ7yxvKLg4b2UizMsisE2NT4HRjMCdS9 Mev2QmET1Y/NNswwtrXVqlALhqiBWiwZ+LEIhP1gsj6ykeGnGpPuTvhvAG9WUfYhU5sk Hu8wgC5d7hrXoMH5NInvHFh1PBZFz/CGeKsjIxyDpr1TNK3Zw3LH7kP73Yt5m9rS86op k3sb5wxSAKxUk73xi1/+O0L8dZYUqdXWa5N7PLmET5NOQGrlG9WtH1gvWp4hge46V1HK /ZtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QU9dWItP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bm19-20020a656e93000000b005e83f3259e2si14653500pgb.165.2024.04.03.13.27.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 13:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QU9dWItP; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130519-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id F0D0BB2842B for ; Wed, 3 Apr 2024 19:52:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90EF21553A2; Wed, 3 Apr 2024 19:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QU9dWItP" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B702E153BFE for ; Wed, 3 Apr 2024 19:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712173952; cv=none; b=aT+ExtoiFEhyYPAU0gdwwe6wfymyeSH1qlsRnbOrpZc+oolDFv32OL0ipBrIhGyCC59ntrDGmvEGwN6NSDIoERxuxE/tidKDL3NOngVgUo1R4AlelK+5ZPRaW9gXRl8fXqIoIfhFZw5lSantaGLKq7fds8jel1dtM0h9TbK4GwY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712173952; c=relaxed/simple; bh=O3WqaLqlUSgQE4OdAcJeqrcZ7Ltnz8VmOwxJv1vB65k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ejLJKszhdDVqo7I6ULMgIqzyaSIT2eWyqWlblGj6lDU2THdlV9Fmbl4ahddwlS0c74eTjxofBShc7v3rlPCKGBBmcdznxeNtBINOAoELL2FvdIi8HraFH/JR+e1RSmMPFJizKWZq8pcDX/hdJAST0PeQcL5hln6m2q7OJyvLJ30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QU9dWItP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B143EC433C7; Wed, 3 Apr 2024 19:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712173952; bh=O3WqaLqlUSgQE4OdAcJeqrcZ7Ltnz8VmOwxJv1vB65k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QU9dWItPR6m2v28c9DW2sRnuCe/4j4AKqo1WPwDPQlCKmqKl3Smi7X9tg9z5HGNo8 gqpkXh2N3hUB7QeWrLMJE2UugmZK34AjWu+6TdzHl4hthTpLkZeu3BXbROtU1MQHjS /10esr6zDb8K466BFd7zmQgVpqXjrXC5o5q9Ni4sWGTJewutdlDlab/kkpk28rX6NS Nze43t/Whs3tFWwQkJMompkWxrpKCLlf/lwhKdhTo1WgMWWO0FSdZ9gkhZf36iQ4sr ItSEJMuTtdph6CJavc9HKILQVoekNIPD9OT8xA16DrLiChxMNwHj+wyLbbFNwbCYrr Ik4k0skB1GXsQ== Date: Wed, 3 Apr 2024 16:52:28 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Namhyung Kim , Adrian Hunter , Jiri Olsa , Linux Kernel Mailing List Subject: Re: [PATCH 1/1] perf annotate: Initialize 'arch' variable not to trip some -Werror=maybe-uninitialized Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Apr 03, 2024 at 09:01:56AM -0700, Ian Rogers wrote: > On Wed, Apr 3, 2024 at 8:16 AM Arnaldo Carvalho de Melo wrote: > > > > In some older distros the build is failing due to > > -Werror=maybe-uninitialized, in this case we know that this isn't the > > case because 'arch' gets initialized by evsel__get_arch(), so just init > > it to NULL to silence those cases. > > > > E.g.: > > > > 32 17.12 opensuse:15.5 : FAIL gcc version 7.5.0 (SUSE Linux) > > util/annotate.c: In function 'hist_entry__get_data_type': > > util/annotate.c:2269:15: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > struct arch *arch; > > ^~~~ > > cc1: all warnings being treated as errors > > > > 43 7.30 ubuntu:18.04-x-powerpc64el : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) > > util/annotate.c: In function 'hist_entry__get_data_type': > > util/annotate.c:2351:36: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > if (map__dso(ms->map)->kernel && arch__is(arch, "x86") && > > ^~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > > > Cc: Adrian Hunter > > Cc: Ian Rogers > > Cc: Jiri Olsa > > Cc: Namhyung Kim > > Signed-off-by: Arnaldo Carvalho de Melo > > This looks fine but I couldn't line up the errors with code in the > tree. I was curious why the "maybe-uninitialized" was failing. Perhaps > evsel__get_arch should set the out argument to NULL when an error > occurs. This fix is also good but may potentially need repeating for > other evsel__get_arch cases, so a fix in evsel__get_arch may be > preferable. > > Reviewed-by: Ian Rogers Trying with this on top, i.e. what you suggests: From 70e6fd996ce7f9c9adbb30640ed666025bf6f1e4 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 3 Apr 2024 16:49:54 -0300 Subject: [PATCH 1/1] WIP Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/annotate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index f316e0b65897957a..35235147b111e788 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -838,8 +838,10 @@ static int evsel__get_arch(struct evsel *evsel, struct arch **parch) struct arch *arch; int err; - if (!arch_name) + if (!arch_name) { + *parch = NULL; return errno; + } *parch = arch = arch__find(arch_name); if (arch == NULL) { @@ -2266,7 +2268,7 @@ struct annotated_data_type *hist_entry__get_data_type(struct hist_entry *he) { struct map_symbol *ms = &he->ms; struct evsel *evsel = hists_to_evsel(he->hists); - struct arch *arch = NULL; + struct arch *arch; struct disasm_line *dl; struct annotated_insn_loc loc; struct annotated_op_loc *op_loc; -- 2.44.0