Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752222AbbH0L1q (ORCPT ); Thu, 27 Aug 2015 07:27:46 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:25278 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751507AbbH0L1p (ORCPT ); Thu, 27 Aug 2015 07:27:45 -0400 Message-ID: <55DEF395.30201@huawei.com> Date: Thu, 27 Aug 2015 19:25:09 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: CC: , Alexei Starovoitov , Masami Hiramatsu , Namhyung Kim , Zefan Li , Subject: Re: [PATCH] perf tools: Don't set cmdline_group_boundary if no evsel is collected References: <1440577949-229453-1-git-send-email-wangnan0@huawei.com> In-Reply-To: <1440577949-229453-1-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.55DEF428.00EA,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0986c2391988168e5cd502adfbe80c4f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1798 Lines: 54 On 2015/8/26 16:32, Wang Nan wrote: > If parse_events__scanner() collects no entry, perf_evlist__last(evlist) > is invalid. Then setting of cmdline_group_boundary touches invalid. > > It could happend in currect BPF implementation. See [1]. Although it > can be fixed, for safety reason it whould be better to introduce this > check. > > [1]: http://lkml.kernel.org/n/1436445342-1402-19-git-send-email-wangnan0@huawei.com > > Signed-off-by: Wang Nan > Cc: Alexei Starovoitov > Cc: Masami Hiramatsu > Cc: Namhyung Kim > Cc: Zefan Li > Cc: pi3orama@163.com > Cc: Arnaldo Carvalho de Melo > --- > tools/perf/util/parse-events.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c > index cce3e43..02609da 100644 > --- a/tools/perf/util/parse-events.c > +++ b/tools/perf/util/parse-events.c > @@ -1171,9 +1171,11 @@ int parse_events(struct perf_evlist *evlist, const char *str, > > perf_evlist__splice_list_tail(evlist, &data.list, entries); > evlist->nr_groups += data.nr_groups; > - last = perf_evlist__last(evlist); > - last->cmdline_group_boundary = true; > > + if (entries > 0) { Now I think chinking this before list splice should be better. Plase ignore this patch. Thank you. > + last = perf_evlist__last(evlist); > + last->cmdline_group_boundary = true; > + } > return 0; > } > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/