Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2898116rdb; Mon, 4 Dec 2023 10:23:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8I8ZWQI5ZvsxOPEGhM9bchhJb1yTVWlQoYKe1U+k3G78ZkNLffp+SiseU0NaOBDiAWUiv X-Received: by 2002:a05:6a20:3e03:b0:18b:d229:1310 with SMTP id m3-20020a056a203e0300b0018bd2291310mr3738817pzc.35.1701714229689; Mon, 04 Dec 2023 10:23:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701714229; cv=none; d=google.com; s=arc-20160816; b=anPX0q+njygRb7MerWn3iXhs+4IQ3zvktNEI1G6ipDoHLiIweoC85l3AWbCBia2YOH WjtKAgc60OTIKHGxBqmy2YIE+MeMWN7dtQNIbdgjjbX9roz2ahiw9rrGWxncaPOWTwdP Oq/t8jjEFH9P6DL2KI+MLKQ4atIqkRCTf3PWVpwqiPmCE8En/p46lUd6zMd4w5222tmA Jh5BgeGAdUwm77FA7OywmI8xP6eas1rNF37DPsssRUiMmwJWWQPn5pFMOy47GgNWEFaE u8TENtd9OmExBwnUg4jQo0NeTo26Ma2TWGoa9AuCmNojMSs4uaseU6eXuvKcDOtxOla3 Cxfw== 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=SZ0pxQHPPtXifBYnQK2oqRhP2CZVwJXTHj6rC9GaE3c=; fh=GdNrbVz4+rD5GDxx28FfX7pstWQA2odnFE24GYz37s4=; b=NH+zmuozxgxp0ha5YjRh8ye2B3n2hPaeaSnSPwSYGtwIh8ybmPHe+y6h8QXg9RPi+g d7ebtXAsOY0XFWwqGSUWrmynKXf1X/23zkhyaWo4l77CAANIj1O24AHCORwiMjotLr+n /UAz/0mMNUGxOdPpA+svxzAN7hBto8jj29EnZl+GphPsgAfgG1wFWjPy4fonOWTMqqMk ydJSTwQ1q7YckRuYtFh5lij3oeRPqGeUhi5TW+/abfOc9A7/khQUJWSAS2/Bm0ICxEhJ L3BsUvwiR2JwMi5V4srbhsbLm55pgZFurzZmkKcXnfv8zSB81cwVTRRd7N3fU1irwLKp zd3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=P9S4QcPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a2-20020a63e842000000b005c62393c133si8198459pgk.795.2023.12.04.10.23.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 10:23:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=P9S4QcPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 075F58046F07; Mon, 4 Dec 2023 10:23:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbjLDSXa (ORCPT + 99 others); Mon, 4 Dec 2023 13:23:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbjLDSXa (ORCPT ); Mon, 4 Dec 2023 13:23:30 -0500 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 45414107 for ; Mon, 4 Dec 2023 10:23:36 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db3ef4c7094so4420408276.1 for ; Mon, 04 Dec 2023 10:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701714215; x=1702319015; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=SZ0pxQHPPtXifBYnQK2oqRhP2CZVwJXTHj6rC9GaE3c=; b=P9S4QcPW5Eh/3vBzx4A6vHvsIbdvrm7Hvr0V0y80HGL8IYg62FJv6KsMWsMFdUaWMO N9qhefubyi1bAbmDVqjYEFrorVqM6RHQCOZNgOG+9i7ZZD4rMWtt+EAikFY7TcK97jNy epM4/byRmFSZyv8abKGyFOSyomlXjYA9AasUlktW06JTychjoMLxbnhTJWLFkxR3HEiI RCxo5XyDefB4n24h4kbjhVVwmuebJhCQl/80WvulztIoHDjVA6P5nvQJLHWzkCJPtHsa tbACaKlXYz6/cCHdQupSqlt0662wrsF7IV0nNneTIdROvdgH2Mf8EglzBeXAAtpiivyO AiWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701714215; x=1702319015; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SZ0pxQHPPtXifBYnQK2oqRhP2CZVwJXTHj6rC9GaE3c=; b=SGm2OLiprvWbTXkT7DOjqlVeMcnLaRsX8q07EuSSGNgXwLtiT89f1sD5etHnXhhP2b tOPJKqOTWiRIFuLvqMnwOykH5RnuIxBiVhbYPt54xhTenwUo96lz2rtI1chAjjVglNJG LtJHBToPYRFlxuSY2sMAM88BpJuMtYrAE4qUg5H/PPfdNyr67a/Ktc9MOqnwkigNDC1H F41Wd5Rub8U3xJBohdt5btW/n1yWfrIGS6AE0QV8RxFQAzWg/0OHxqOaD9DmnsDCt1pr XXvo66EW4q7X8AMDCHuN1F/lQwoMeOb0isC2epTnQGuTiUZO96r0A0af9gZAPKB32Nb7 /yUA== X-Gm-Message-State: AOJu0YwYeKD6icmluLJ2Vb7FHdqRparwX+Q4X56vjhg4tfLyUNgvP9I0 9LR+LG5RbtWYMBZ2mNVjWR6cVUNyAXdj X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b241:d804:967e:c827]) (user=irogers job=sendgmr) by 2002:a25:cace:0:b0:db5:4692:3aae with SMTP id a197-20020a25cace000000b00db546923aaemr331621ybg.4.1701714215509; Mon, 04 Dec 2023 10:23:35 -0800 (PST) Date: Mon, 4 Dec 2023 10:23:29 -0800 Message-Id: <20231204182330.654255-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v1 1/2] perf metrics: Avoid segv if default metricgroup isn't set From: Ian Rogers To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Ilkka Koskinen , Kan Liang , Kajol Jain , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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,T_SCC_BODY_TEXT_LINE, 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 howler.vger.email 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 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 10:23:45 -0800 (PST) A metric is default by having "Default" within its groups. The default metricgroup name needn't be set and this can result in segv in default_metricgroup_cmp and perf_stat__print_shadow_stats_metricgroup that assume it has a value when there is a Default metric group. To avoid the segv initialize the value to "". Fixes: 1c0e47956a8e ("perf metrics: Sort the Default metricgroup") Signed-off-by: Ian Rogers --- tools/perf/util/metricgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 0484736d9fe4..ca3e0404f187 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -225,7 +225,7 @@ static struct metric *metric__new(const struct pmu_metric *pm, m->pmu = pm->pmu ?: "cpu"; m->metric_name = pm->metric_name; - m->default_metricgroup_name = pm->default_metricgroup_name; + m->default_metricgroup_name = pm->default_metricgroup_name ?: ""; m->modifier = NULL; if (modifier) { m->modifier = strdup(modifier); -- 2.43.0.rc2.451.g8631bc7472-goog