Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932105AbdHWOmA (ORCPT ); Wed, 23 Aug 2017 10:42:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754053AbdHWOl6 (ORCPT ); Wed, 23 Aug 2017 10:41:58 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B6DD20C48 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Wed, 23 Aug 2017 10:41:55 -0400 From: Steven Rostedt To: Chunyu Hu Cc: mingo@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] tracing: Fix kmemleak in set_trigger_filter Message-ID: <20170823104155.27f7c6f6@gandalf.local.home> In-Reply-To: <20170823103836.584a5dc5@gandalf.local.home> References: <1502705898-27571-1-git-send-email-chuhu@redhat.com> <1502705898-27571-2-git-send-email-chuhu@redhat.com> <20170823103836.584a5dc5@gandalf.local.home> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1059 Lines: 25 On Wed, 23 Aug 2017 10:38:36 -0400 Steven Rostedt wrote: > > +++ b/kernel/trace/trace_events_trigger.c > > @@ -739,7 +739,7 @@ int set_trigger_filter(char *filter_str, > > /* The filter is for the 'trigger' event, not the triggered event */ > > ret = create_event_filter(file->event_call, filter_str, false, &filter); > > The filter is allocated by create_event_filter. If that returns a > failure, then that should be the one to free it. It is bad taste to > require the calling function to require it. I take that back. I just read the comment above create_event_filter(): * On success, returns 0 and *@filterp points to the new filter. On * failure, returns -errno and *@filterp may point to %NULL or to a new * filter. In the latter case, the returned filter contains error * information if @set_str is %true and the caller is responsible for * freeing it. So filter contains an error string when it fails. It seems that we should somehow propagate that up the chain to display. I'll look more into this. -- Steve