All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: tracing: Make tracer_flags use the right set_flag callback
Date: Thu, 10 Mar 2016 19:44:03 +0000	[thread overview]
Message-ID: <20160310194403.GA17979@mwanda> (raw)

Hello Chunyu Hu,

The patch d39cdd2036a6: "tracing: Make tracer_flags use the right
set_flag callback" from Mar 8, 2016, leads to the following
Smatch warning:

kernel/trace/trace.c:1303 register_tracer()
warn: inconsistent returns 'mutex:&trace_types_lock'.
  Locked on:   line 1260
  Unlocked on: line 1232
               line 1237
               line 1303


kernel/trace/trace.c
  1253  
  1254          if (!type->set_flag)
  1255                  type->set_flag = &dummy_set_flag;
  1256          if (!type->flags) {
  1257                  /*allocate a dummy tracer_flags*/
  1258                  type->flags = kmalloc(sizeof(*type->flags), GFP_KERNEL);
  1259                  if (!type->flags)
  1260                          return -ENOMEM;

Should probably be a goto out.

  1261                  type->flags->val = 0;
  1262                  type->flags->opts = dummy_tracer_opt;
  1263          } else
  1264                  if (!type->flags->opts)
  1265                          type->flags->opts = dummy_tracer_opt;
  1266  
  1267          /* store the tracer for __set_tracer_option */
  1268          type->flags->trace = type;
  1269  
  1270          ret = run_tracer_selftest(type);
  1271          if (ret < 0)
  1272                  goto out;
  1273  
  1274          type->next = trace_types;
  1275          trace_types = type;
  1276          add_tracer_options(&global_trace, type);
  1277  
  1278   out:
  1279          tracing_selftest_running = false;
  1280          mutex_unlock(&trace_types_lock);
  1281  
  1282          if (ret || !default_bootup_tracer)
  1283                  goto out_unlock;

It's weird that goto out_unlock doesn't unlock.


  1284  

regards,
dan carpenter

             reply	other threads:[~2016-03-10 19:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 19:44 Dan Carpenter [this message]
2016-03-11 11:50 ` tracing: Make tracer_flags use the right set_flag callback Chunyu Hu
2016-03-11 14:31 ` Steven Rostedt
2016-03-14  8:42 ` 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=20160310194403.GA17979@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 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.