mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Alexander Z Lam <azl@google.com>
Cc: linux-kernel@vger.kernel.org, David Sharp <dhsharp@google.com>,
	Vaibhav Nagarnaik <vnagarnaik@google.com>,
	Alexander Z Lam <lambchop468@gmail.com>
Subject: Re: [PATCH v2] tracing: Miscellaneous fixes for trace_array ref counting
Date: Thu, 18 Jul 2013 13:59:54 -0400	[thread overview]
Message-ID: <1374170394.6458.252.camel@gandalf.local.home> (raw)
In-Reply-To: <1374169621-31314-1-git-send-email-azl@google.com>

On Thu, 2013-07-18 at 10:47 -0700, Alexander Z Lam wrote:
>  
>  static const struct file_operations tracing_iter_fops = {
> @@ -3958,7 +3965,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
>  	iter = kzalloc(sizeof(*iter), GFP_KERNEL);
>  	if (!iter) {
>  		ret = -ENOMEM;
> -		goto out;
> +		goto fail_iter;
>  	}
>  
>  	/*
> @@ -3968,13 +3975,13 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
>  	iter->trace = kmalloc(sizeof(*iter->trace), GFP_KERNEL);
>  	if (!iter->trace) {
>  		ret = -ENOMEM;
> -		goto fail;
> +		goto fail_trace;
>  	}
>  	*iter->trace = *tr->current_trace;
>  
>  	if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) {
>  		ret = -ENOMEM;
> -		goto fail;
> +		goto fail_trace;
>  	}
>  
>  	/* trace pipe does not show start of buffer */
> @@ -4001,9 +4008,10 @@ out:
>  	mutex_unlock(&trace_types_lock);
>  	return ret;
>  
> -fail:
> +fail_trace:
>  	kfree(iter->trace);
>  	kfree(iter);
> +fail_iter:
>  	__trace_array_put(tr);
>  	mutex_unlock(&trace_types_lock);
>  	return ret;


You missed my comment about not adding the extra label. The only change
to the code above should have been:

	if (!iter) {
		ret = -ENOMEM;
+		__trace_array_put(tr);
		goto out;
	}

A one liner.

-- Steve


      reply	other threads:[~2013-07-18 17:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 17:47 Alexander Z Lam
2013-07-18 17:59 ` Steven Rostedt [this message]

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=1374170394.6458.252.camel@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=azl@google.com \
    --cc=dhsharp@google.com \
    --cc=lambchop468@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vnagarnaik@google.com \
    /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

all inboxes | Powered by JetHome®