Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp208918pxx; Mon, 26 Oct 2020 06:56:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7uIIq4blLJ71poMhrkXCPq3/wJ1FeXJIf0O8bkj1cTiUY1VIkte+/cLH1fv4A+Vem/yoR X-Received: by 2002:a17:906:319a:: with SMTP id 26mr16647036ejy.9.1603720615102; Mon, 26 Oct 2020 06:56:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603720615; cv=none; d=google.com; s=arc-20160816; b=rxXVhHeQ2WYxvx+mWoqxdz5wKmxLLFw5ONQ0Gmnc3bgiXewhaiMS1wtHCOU7oZ0ghz jeQmBal6wIiOEDOAWmARw0NGeDzLko1utYsyOjUcBJIDo0gYDL6D1jVE4vsR/oahUqF9 zpYKka5PA8O1UcItpUuCEr42BeSlyX+vbD1leJvqlV2zrO7RX0fkuLw4cdbpPJZ1SUZE EsW9pi8iuX5VhV2vR/UjPk/2a7KDjpFkv62mVuH7DU7lKUcS3oonJDHHzArp44bffiA0 b2Nb8hgQJem48hFqZwd9GAaRx4br2+42Vjz9vYz/HAWbC6I9bRINt/SRa/N1115agZ3r IhDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sT+9Spi7xz4GAW2bOEkLPjqtvHVcypfp3Jv+RAeqjqg=; b=QXPI0kJ9Dk3cpoqee3OLQ08PQcThiJ0wQ0DyFA0G5tpMA1Jfok/937G1MN/cA8MP0r Ad0FR7wRvnxB/7cBRaaPX8R0Bmx4+SLCIwIF+21gc6KMxxQXbQkNYUedSg0AM3gzxnmn a5So9daMKrLTBJoBcWLueHnedbX0DsBuTYFF/Kyhr6Cy+ctPZK5mw8r9ERVJDr7ew5+z 5njusTBPXZFKqQMmlMhqZALSiD7deVy3pl2UY4fU+nutgeCUMBbGctyXuqy1mSkKTsMJ TDs+xoRmNqmfzkbD/ghSKKl8q0VVqik+flNJ/SjGytfqdOM2a/4IXfwusm4aREfxMMfd futQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=uj1CrjG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t6si6883376ejr.744.2020.10.26.06.56.32; Mon, 26 Oct 2020 06:56:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=uj1CrjG8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1774661AbgJZN22 (ORCPT + 99 others); Mon, 26 Oct 2020 09:28:28 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:60472 "EHLO forwardcorp1j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1770618AbgJZN21 (ORCPT ); Mon, 26 Oct 2020 09:28:27 -0400 X-Greylist: delayed 443 seconds by postgrey-1.27 at vger.kernel.org; Mon, 26 Oct 2020 09:28:25 EDT Received: from myt5-23f0be3aa648.qloud-c.yandex.net (myt5-23f0be3aa648.qloud-c.yandex.net [IPv6:2a02:6b8:c12:3e29:0:640:23f0:be3a]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id 5D20C2E1501; Mon, 26 Oct 2020 16:21:01 +0300 (MSK) Received: from myt4-18a966dbd9be.qloud-c.yandex.net (myt4-18a966dbd9be.qloud-c.yandex.net [2a02:6b8:c00:12ad:0:640:18a9:66db]) by myt5-23f0be3aa648.qloud-c.yandex.net (mxbackcorp/Yandex) with ESMTP id A2oaGvXCwk-L0xKnfPJ; Mon, 26 Oct 2020 16:21:01 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1603718461; bh=sT+9Spi7xz4GAW2bOEkLPjqtvHVcypfp3Jv+RAeqjqg=; h=Message-Id:Date:Subject:To:From:Cc; b=uj1CrjG84NbMU6fE+KT1wjrNckltuWXhDtqghDboHv06CoWh0QIozcWgtzg0daY60 W5TIjiDaEFlD4dRJo+EIk21gNRlGZf7a0lCL2N6GlKdv8oQclUs/zwsNFw1lb2QMVY mmeZrCATu851J8JgCjmoDp0nAdFHyIc9GnEifxOo= Authentication-Results: myt5-23f0be3aa648.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from unknown (unknown [178.154.136.47]) by myt4-18a966dbd9be.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 8kf51WfDhm-L0mib759; Mon, 26 Oct 2020 16:21:00 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) From: Stanislav Ivanichkin To: linux-kernel@vger.kernel.org Cc: linux-perf-users@vger.kernel.org, dmtrmonakhov@yandex-team.ru, namhyung@gmail.com Subject: [PATCH v2] perf trace: Segfault when trying to trace events by cgroup Date: Mon, 26 Oct 2020 16:20:34 +0300 Message-Id: <20201026132034.80464-1-sivanichkin@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v2: - struct declaration fixed (Namhyung Kim) Fixes: 9ea42ba4411ac ("perf trace: Support setting cgroups as targets") Signed-off-by: Stanislav Ivanichkin --- tools/perf/builtin-trace.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 44a75f234db1..de80534473af 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4639,9 +4639,9 @@ static int trace__parse_events_option(const struct option *opt, const char *str, err = 0; if (lists[0]) { - struct option o = OPT_CALLBACK('e', "event", &trace->evlist, "event", - "event selector. use 'perf list' to list available events", - parse_events_option); + struct option o = { + .value = &trace->evlist, + }; err = parse_events_option(&o, lists[0], 0); } out: @@ -4655,9 +4655,12 @@ static int trace__parse_cgroups(const struct option *opt, const char *str, int u { struct trace *trace = opt->value; - if (!list_empty(&trace->evlist->core.entries)) - return parse_cgroups(opt, str, unset); - + if (!list_empty(&trace->evlist->core.entries)) { + struct option o = { + .value = &trace->evlist, + }; + return parse_cgroups(&o, str, unset); + } trace->cgroup = evlist__findnew_cgroup(trace->evlist, str); return 0; -- 2.17.1