Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3650717rdb; Wed, 13 Sep 2023 20:30:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWgIoOF90trNYEvjlSUv/PMoOFpYMlFMRGC6T7ixMsVYwFzpggm4gBIWxM21UJN7Kkmnxi X-Received: by 2002:a05:6a20:3cac:b0:126:9081:2156 with SMTP id b44-20020a056a203cac00b0012690812156mr5167246pzj.4.1694662232267; Wed, 13 Sep 2023 20:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694662232; cv=none; d=google.com; s=arc-20160816; b=Q2I58gzZdQFWj4D0qi+4g1a71hbbwIbcg73FZRbgIzipBMxSSnszmzhwGLYbH76alZ QOOynaceF0mqHr/Zqh4UE+2gfqJb4k+pbiyBg1iukkLmeM7RvrKcaNt1rTUYZSVgrGqr jeiodowzKi13Yc0dI7KIdqWmPmmGcW3JGrCwTpOD9iv+gRw16015IXkl/juCnVrqafMF N2ZpZ1P9OXsueET/WcQuN1vlplq2o/UdUT1VS7TT+ewWlH/wau37AbB0PaIo6LnthVe+ axz77sayTQvwRjV48Mv+lQlFNTW13lZxsDyRAxcVug4h3wx86CembcX8cS/OdcfkITAG h+Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=mr6eRGX/mot4ysHxW2nXh0B8TIVosY14z+Vg1QOhCRI=; fh=23Sy7F7j04HCNFiI93rjtmIRuMqiWaHnk9tr22KIUac=; b=JptKtlFg/Q0Cs42wJNs0QDgFnPVSaCznLe4LM0/nFqekj4X2Cz7zuKvtxxQel7g410 B9UA8RErBV/XGolCiivy9bHnJ+/H9LTQMKO/SXrDSn2p4UhNZmFR7vJZ+P5+wbc9dxjt FO6Sm7A9+b1rOnrMl54drqgc8nQm2w1U9AOAW8BG/iLopQ1H62efQHtln2DTv52TMZLj vZ/M0u0LB7VgTWBiO9ApUT7L8pbsszCI7wjBon6NctoqvMQxAN6oafQgxxQ7/aMLp0Y5 /LFbh+A4oW6TPw+/9R8ayPMdCMIsqriNrWTKspwjXmHYWrgO2hDzG4Pu6YNWBQdPRO0I 3Q1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jEYk0O0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d11-20020a170902f14b00b001b8a699d248si668447plb.389.2023.09.13.20.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 20:30:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=jEYk0O0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A810780B31F5; Wed, 13 Sep 2023 19:24:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233160AbjINCYf (ORCPT + 99 others); Wed, 13 Sep 2023 22:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233483AbjINCYe (ORCPT ); Wed, 13 Sep 2023 22:24:34 -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 DBC64198 for ; Wed, 13 Sep 2023 19:24:30 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d8141d6fbe3so614419276.3 for ; Wed, 13 Sep 2023 19:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694658270; x=1695263070; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=mr6eRGX/mot4ysHxW2nXh0B8TIVosY14z+Vg1QOhCRI=; b=jEYk0O0GqLNvr7w9JKUGQI+pV7PWXZkv7SPKQ6XmSFZM+C65Os5joK590+nvWe0Lwp +cPeGLyn5AHJprhBXPkRPGbGVfwYK3FbRyGZW/UQwoU9d7NuSGq9cKuoVKd03FTvwDkJ d2kbo6e2MC/mvUhloIR9kQsQaRE5DLZfHh1ySYE8YVGqEKwV9B00o9id9KPPXIEv8H+L imxqA6AX8lzhDhPa67jwHIQfpIZVp5oGXgyb8DRBj8Un0hwkKW9V14eGpm5NFLgQI025 cvzaEahlleo4OBZIMIgU/z06YjqswoIp6toq+2RBh4yGoqYp74rWesSoe8p4A4rM3uPk QQkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694658270; x=1695263070; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mr6eRGX/mot4ysHxW2nXh0B8TIVosY14z+Vg1QOhCRI=; b=jC1M67RlHWvNA/S/GxyXEws461853pPwSL/kEK2PkFjGCACpyB3uGXgXjb6alNdT2T Ow3n+Qhb71km4y3p15UljGE0iGA6bWl9TPZ0TfYtZ0nAXz98afg9gYoFW6+DPGIq1nk2 KWAf04Sz7d7VeS5wA1sZ1bxSC4LnF4FL/1WGsnQNH4fdPDIOBUbYVWHNks/g9Z59s7RQ +nFDD31Yn+AmE35lkRQ7C83kVT5TBl+iBT6PztvTtt1YgP7AAzsLG5GU5XW6Gh4o5zaR JP/4QL10UxuDLQY0ExXmaPRNFvNng3L21osYBNWYpUibB2E8BORt7RmGW3amesxSQQEu zzUA== X-Gm-Message-State: AOJu0YwdRLLZg/2mpfPUPmrJRWxGF0N1amkzaKt4rVKQPmhBA00kStCL vNT0y2wf4pe1jyT6WJCCeVfmTCCgsOBB X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7612:4bb6:bcf1:779c]) (user=irogers job=sendgmr) by 2002:a5b:8d:0:b0:d78:245a:aac4 with SMTP id b13-20020a5b008d000000b00d78245aaac4mr100091ybp.1.1694658270080; Wed, 13 Sep 2023 19:24:30 -0700 (PDT) Date: Wed, 13 Sep 2023 19:24:25 -0700 Message-Id: <20230914022425.1489035-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Subject: [PATCH v1] perf pmu: Ensure all alias variables are initialized From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kan Liang , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 19:24:44 -0700 (PDT) X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Fix an error detected by memory sanitizer: ``` ==4033==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x55fb0fbedfc7 in read_alias_info tools/perf/util/pmu.c:457:6 #1 0x55fb0fbea339 in check_info_data tools/perf/util/pmu.c:1434:2 #2 0x55fb0fbea339 in perf_pmu__check_alias tools/perf/util/pmu.c:1504:9 #3 0x55fb0fbdca85 in parse_events_add_pmu tools/perf/util/parse-events.c:1429:32 #4 0x55fb0f965230 in parse_events_parse tools/perf/util/parse-events.y:299:6 #5 0x55fb0fbdf6b2 in parse_events__scanner tools/perf/util/parse-events.c:1822:8 #6 0x55fb0fbdf8c1 in __parse_events tools/perf/util/parse-events.c:2094:8 #7 0x55fb0fa8ffa9 in parse_events tools/perf/util/parse-events.h:41:9 #8 0x55fb0fa8ffa9 in test_event tools/perf/tests/parse-events.c:2393:8 #9 0x55fb0fa8f458 in test__pmu_events tools/perf/tests/parse-events.c:2551:15 #10 0x55fb0fa6d93f in run_test tools/perf/tests/builtin-test.c:242:9 #11 0x55fb0fa6d93f in test_and_print tools/perf/tests/builtin-test.c:271:8 #12 0x55fb0fa6d082 in __cmd_test tools/perf/tests/builtin-test.c:442:5 #13 0x55fb0fa6d082 in cmd_test tools/perf/tests/builtin-test.c:564:9 #14 0x55fb0f942720 in run_builtin tools/perf/perf.c:322:11 #15 0x55fb0f942486 in handle_internal_command tools/perf/perf.c:375:8 #16 0x55fb0f941dab in run_argv tools/perf/perf.c:419:2 #17 0x55fb0f941dab in main tools/perf/perf.c:535:3 ``` Fixes: 7b723dbb96e8 ("perf pmu: Be lazy about loading event info files from sysfs") Signed-off-by: Ian Rogers --- tools/perf/util/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index d85602aa4b9f..8de6f39abd1b 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -520,7 +520,7 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, pmu_name = pe->pmu; } - alias = malloc(sizeof(*alias)); + alias = zalloc(sizeof(*alias)); if (!alias) return -ENOMEM; -- 2.42.0.459.ge4e396fd5e-goog