All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [bug report] tracing: Factorize filter creation
Date: Mon, 26 Mar 2018 14:36:47 +0000	[thread overview]
Message-ID: <20180326143647.GA1840639@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <20180323084612.GA23928@mwanda>

Hey, Dan.

On Fri, Mar 23, 2018 at 11:49:32AM +0300, Dan Carpenter wrote:
> Hm...  No.  I get a second warning:
> 
> kernel/trace/trace_events_filter.c:2052 ftrace_profile_set_filter()
> error: uninitialized symbol 'filter'.
> 
> kernel/trace/trace_events_filter.c
>   2036  
>   2037          err = -EEXIST;
>   2038          if (event->filter)
>   2039                  goto out_unlock;
>   2040  
>   2041          err = create_filter(call, filter_str, false, &filter);
>   2042          if (err)
>   2043                  goto free_filter;
>                              ^^^^^^^^^^^
> filter is uninitialized.  What are we supposed to be freeing?
> 
>   2044  
>   2045          if (ftrace_event_is_function(call))
>   2046                  err = ftrace_function_set_filter(event, filter);
>   2047          else
>   2048                  event->filter = filter;
>   2049  
>   2050  free_filter:
>   2051          if (err || ftrace_event_is_function(call))
>   2052                  __free_filter(filter);

This does look suspicious but __free_filter() checks for NULL input
and please take a look at the following comment from create_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.

It looks like the function could return !NULL filter w/ error.  Kinda
confusing but the code doesn't look wrong.

Thanks.

-- 
tejun

  parent reply	other threads:[~2018-03-26 14:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  8:46 [bug report] tracing: Factorize filter creation Dan Carpenter
2018-03-23  8:49 ` Dan Carpenter
2018-03-26 14:32 ` Tejun Heo
2018-03-26 14:36 ` Tejun Heo [this message]
2018-03-26 16:07 ` Dan Carpenter
2018-03-26 16:35 ` Tejun Heo
2018-03-27  7:23 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180326143647.GA1840639@devbig577.frc2.facebook.com \
    --to=tj@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.