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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10AEBC5DF64 for ; Wed, 6 Nov 2019 14:07:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D633E20663 for ; Wed, 6 Nov 2019 14:07:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gLaTYVUn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731790AbfKFOHG (ORCPT ); Wed, 6 Nov 2019 09:07:06 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:25899 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727324AbfKFOHG (ORCPT ); Wed, 6 Nov 2019 09:07:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573049225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kQUJhTS5ZQPa+H7gyw31F1k30QCMAlnrwuTj8cTiw28=; b=gLaTYVUn6kD9WkF0dMmEDGdz2CosD2e3eoxCQT5zEMq07ip7LyRlWM20eaBadufyP328N2 W+CZZttraCUlln0w3VsMbZ2ohh1e5oIt4TXccsdeMuKQXdPAFxEhMOfdouXMz2Nkya5ZJd wH1/fHMAhFu6KxbOZy2rOzypHwj4R+o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-HIuIU22MPBuvr-Q7-vH7Vw-1; Wed, 06 Nov 2019 09:06:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 257561005500; Wed, 6 Nov 2019 14:06:57 +0000 (UTC) Received: from krava (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with SMTP id 513F25DA76; Wed, 6 Nov 2019 14:06:51 +0000 (UTC) Date: Wed, 6 Nov 2019 15:06:50 +0100 From: Jiri Olsa To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andi Kleen , Jin Yao , Adrian Hunter , Kan Liang , John Garry , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, clang-built-linux@googlegroups.com, Stephane Eranian Subject: Re: [PATCH v5 01/10] perf tools: add parse events handle error Message-ID: <20191106140650.GE30214@krava> References: <20191025180827.191916-1-irogers@google.com> <20191030223448.12930-1-irogers@google.com> <20191030223448.12930-2-irogers@google.com> MIME-Version: 1.0 In-Reply-To: <20191030223448.12930-2-irogers@google.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: HIuIU22MPBuvr-Q7-vH7Vw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 30, 2019 at 03:34:39PM -0700, Ian Rogers wrote: > Parse event error handling may overwrite one error string with another > creating memory leaks. Introduce a helper routine that warns about > multiple error messages as well as avoiding the memory leak. >=20 > A reproduction of this problem can be seen with: > perf stat -e c/c/ > After this change this produces: > WARNING: multiple event parsing errors > event syntax error: 'c/c/' > \___ unknown term >=20 > valid terms: event,filter_rem,filter_opc0,edge,filter_isoc,filter_tid,fil= ter_loc,filter_nc,inv,umask,filter_opc1,tid_en,thresh,filter_all_op,filter_= not_nm,filter_state,filter_nm,config,config1,config2,name,period,percore > Run 'perf list' for a list of valid events >=20 > Usage: perf stat [] [] >=20 > -e, --event event selector. use 'perf list' to list availab= le events >=20 > Signed-off-by: Ian Rogers Acked-by: Jiri Olsa thanks, jirka