From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82ACEC001B0 for ; Mon, 24 Jul 2023 20:13:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbjGXUNB (ORCPT ); Mon, 24 Jul 2023 16:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbjGXUNA (ORCPT ); Mon, 24 Jul 2023 16:13:00 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F044E10E0 for ; Mon, 24 Jul 2023 13:12:58 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-c647150c254so8412209276.1 for ; Mon, 24 Jul 2023 13:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690229578; x=1690834378; h=content-transfer-encoding:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:from:to:cc:subject:date :message-id:reply-to; bh=cpe672BMcYgw1/Tq0sSVEvWbR/AI8Dk2IlobtDn5kyw=; b=2M2G+MvDUvaC4v3ryP+ApSPqOaSP4AH5XVMKamZ8urbsjFkVLNInRrp2LTZ/GqUZim qN+Jv3Tt2AdT+frefTxmqnDGCW+wiZlucBQpvp7lKsJF/MEHEZSgNYS8ZzT80rswNt2f ZUdMU4hEFhqNlBCBWiq69krhqG2Ke7uhcA9GQxgcQyk8GWmhFMbhhyfK4ojYwJDtdno+ GCY20xkBVTXG3/EHvQ4sI2oVmRKUGmCgihTYSmi6ie8nP85rl7+SMKT7+z5QlAyTmh2B kXqutf119zg8ph1niL6MYGmn1vDpOeWPobVxKNmAbtAvQ4YHSswk/InZE2XTOtMsuUe2 2kKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690229578; x=1690834378; h=content-transfer-encoding:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cpe672BMcYgw1/Tq0sSVEvWbR/AI8Dk2IlobtDn5kyw=; b=dg9Z0oJ9oir6HymLOdTKVlpTDGhl3G2wXuEufCDgt0WKzFIP50NxFSbaXKp6u1sZdW IyZ9oJ7EfYNJdzIPGWzcDBaXC3fVdu73GlJhNstTJ9jwvyVdJDoSUCGPCczNcNNz/OQ4 hwKNq821brYMGZOafWS9KFv9687x9jmJWMOKoB3RBSn72R8qAbpsU5QUflA2vroc39+0 H5HkCuBwtVVDhdiPYBwR7CqecFeAmmQoDRMvia/Zm+5RyrjloTUvYyJ1ULoVQ3mjbVeQ kD9o7zpbtJ2cysw1dSfSY70qhNvu/A2ueKzp06/WLkurdZO61rIIrd7hdmZouNkRxDsZ 5CHg== X-Gm-Message-State: ABy/qLZGsLV/RcfUDqImVPQQ/awX6sHTwz3n7mKUrNeqYumCYHw2MvEu IbDyhbMPHcSJ5bn400JMn9uhklPffDwq X-Google-Smtp-Source: APBJJlF+r3JvE4POU8/iw3zmTMqwkKUWM9A4TplQkBMkPp+JYJG+ZBQQK2pKifSkc8U/9qvm8anWelibR1RQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:5724:8dc0:46f0:f963]) (user=irogers job=sendgmr) by 2002:a25:ac1f:0:b0:d04:6d5e:4ded with SMTP id w31-20020a25ac1f000000b00d046d5e4dedmr1994ybi.6.1690229578123; Mon, 24 Jul 2023 13:12:58 -0700 (PDT) Date: Mon, 24 Jul 2023 13:12:45 -0700 In-Reply-To: <20230724201247.748146-1-irogers@google.com> Message-Id: <20230724201247.748146-3-irogers@google.com> Mime-Version: 1.0 References: <20230724201247.748146-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Subject: [PATCH v1 2/4] perf parse-events: Avoid use uninitialized warning From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Kan Liang , Yang Jihong , Ravi Bangoria , Carsten Haitzler , Zhengjun Xing , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Cc: maskray@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org With GCC LTO a potential use uninitialized is spotted: ``` In function =E2=80=98parse_events_config_bpf=E2=80=99, inlined from =E2=80=98parse_events_load_bpf=E2=80=99 at util/parse-even= ts.c:874:8: util/parse-events.c:792:37: error: =E2=80=98error_pos=E2=80=99 may be used = uninitialized [-Werror=3Dmaybe-uninitialized] 792 | idx =3D term->err_term + error_pos; | ^ util/parse-events.c: In function =E2=80=98parse_events_load_bpf=E2=80=99: util/parse-events.c:765:13: note: =E2=80=98error_pos=E2=80=99 was declared = here 765 | int error_pos; | ^ ``` So initialize at declaration. Signed-off-by: Ian Rogers --- tools/perf/util/parse-events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.= c index acde097e327c..da29061ecf49 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -762,7 +762,7 @@ parse_events_config_bpf(struct parse_events_state *pars= e_state, struct list_head *head_config) { struct parse_events_term *term; - int error_pos; + int error_pos =3D 0; =20 if (!head_config || list_empty(head_config)) return 0; --=20 2.41.0.487.g6d72f3e995-goog