From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754651AbdHVHX5 (ORCPT ); Tue, 22 Aug 2017 03:23:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbdHVHX4 (ORCPT ); Tue, 22 Aug 2017 03:23:56 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A004C04B333 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Tue, 22 Aug 2017 09:23:54 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Andi Kleen , Andi Kleen , jolsa@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error Message-ID: <20170822072354.GB21829@krava> References: <20170816220201.19182-1-andi@firstfloor.org> <20170816220201.19182-3-andi@firstfloor.org> <20170817152816.GC10891@kernel.org> <20170817164213.GE10891@kernel.org> <20170817170453.GL28715@tassilo.jf.intel.com> <20170817172232.GF10891@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170817172232.GF10891@kernel.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 22 Aug 2017 07:23:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 17, 2017 at 02:22:32PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Aug 17, 2017 at 10:04:53AM -0700, Andi Kleen escreveu: > > > So it will _not_ set to null a member that it doesn't have, i.e. the > > > minimal fix is to just have the hunks below, making sure that the error > > > field is present in both structs. No need to set > > > parse_event_terms->error to anything, it will be set to null since other > > > fields are set to something. > > > > Right but I want to see the error too. That is why I added a real > > error handler. > > Ok, but I was first trying to figure out the fix for that separate > problem (the void pointer being dereferenced to two different types in > the same function, yyparse, aka parse_events_parse), then we can go to > the 'too' part :-) > > I'm adding the patch below, that should fix things by using just one > state struct for parsing. > > This is done on top of another that renames 'struct parse_events_evlist' > to a more clearer 'struct parse_events_state'. > > I'll then add what is left of your patch, run tests and we go from > there, holler if I'm now missing something. nice catch, I saw the fixes in your branch, look ok thanks, jirka