public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] tracing: Factorize filter creation
Date: Fri, 23 Mar 2018 08:46:12 +0000	[thread overview]
Message-ID: <20180323084612.GA23928@mwanda> (raw)

Hello Tejun Heo,

The patch 38b78eb85540: "tracing: Factorize filter creation" from Dec
15, 2011, leads to the following static checker warning:

	kernel/trace/trace_events_filter.c:1794 apply_event_filter()
	error: uninitialized symbol 'filter'.

kernel/trace/trace_events_filter.c
  1764  int apply_event_filter(struct trace_event_file *file, char *filter_string)
  1765  {
  1766          struct trace_event_call *call = file->event_call;
  1767          struct event_filter *filter;
                                    ^^^^^^^
  1768          int err;
  1769  
  1770          if (!strcmp(strstrip(filter_string), "0")) {
  1771                  filter_disable(file);
  1772                  filter = event_filter(file);
  1773  
  1774                  if (!filter)
  1775                          return 0;
  1776  
  1777                  event_clear_filter(file);
  1778  
  1779                  /* Make sure the filter is not being used */
  1780                  synchronize_sched();
  1781                  __free_filter(filter);
  1782  
  1783                  return 0;
  1784          }
  1785  
  1786          err = create_filter(call, filter_string, true, &filter);
                                                               ^^^^^^^
  1787  
  1788          /*
  1789           * Always swap the call filter with the new filter
  1790           * even if there was an error. If there was an error
  1791           * in the filter, we disable the filter and show the error
  1792           * string
  1793           */
  1794          if (filter) {
                    ^^^^^^
I guess the fix is probably to set filter to NULL in create_filter()?

  1795                  struct event_filter *tmp;
  1796  
  1797                  tmp = event_filter(file);
  1798                  if (!err)
  1799                          event_set_filtered_flag(file);
  1800                  else
  1801                          filter_disable(file);
  1802  
  1803                  event_set_filter(file, filter);
  1804  
  1805                  if (tmp) {
  1806                          /* Make sure the call is done with the filter */
  1807                          synchronize_sched();

regards,
dan carpenter

             reply	other threads:[~2018-03-23  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  8:46 Dan Carpenter [this message]
2018-03-23  8:49 ` [bug report] tracing: Factorize filter creation Dan Carpenter
2018-03-26 14:32 ` Tejun Heo
2018-03-26 14:36 ` Tejun Heo
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=20180323084612.GA23928@mwanda \
    --to=dan.carpenter@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox