LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: rostedt@goodmis.org, tglx@linutronix.de, mhiramat@kernel.org,
	vedang.patel@intel.com, bigeasy@linutronix.de,
	joel@joelfernandes.org, mathieu.desnoyers@efficios.com,
	julia@ni.com, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org, kernel-team@lge.com
Subject: Re: [PATCH v3 6/7] tracing: Add snapshot action
Date: Fri, 10 Aug 2018 16:04:04 +0900
Message-ID: <20180810070404.GD479@sejong> (raw)
In-Reply-To: <b3cfc09e0c3e55dc0d6682cd2b89525f3f446665.1533753152.git.tom.zanussi@linux.intel.com>

On Thu, Aug 09, 2018 at 09:34:16AM -0500, Tom Zanussi wrote:
> From: Tom Zanussi <tom.zanussi@linux.intel.com>
> 
> Add support for hist:handlerXXX($var).snapshot(), which will take a
> snapshot of the current trace buffer whenever handlerXXX is hit.
> 
> As a first user, this also adds snapshot() action support for the
> onmax() handler i.e. hist:onmax($var).snapshot().
> 
> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---

[SNIP]
> +static struct track_data *track_data_alloc(unsigned int key_len,
> +					   struct action_data *action_data,
> +					   struct hist_trigger_data *hist_data)
> +{
> +	struct track_data *data = kzalloc(sizeof(*data), GFP_KERNEL);
> +	unsigned int size = TASK_COMM_LEN;
> +	struct hist_elt_data *elt_data;
> +
> +	if (!data)
> +		return ERR_PTR(-ENOMEM);
> +
> +	data->key = kzalloc(key_len, GFP_KERNEL);
> +	if (!data->key) {
> +		track_data_free(data);
> +		return ERR_PTR(-ENOMEM);
> +	}
> +
> +	data->key_len = key_len;
> +	data->action_data = action_data;
> +	data->hist_data = hist_data;
> +
> +	elt_data = kzalloc(sizeof(*elt_data), GFP_KERNEL);
> +	if (!elt_data) {
> +		track_data_free(data);
> +		return ERR_PTR(-ENOMEM);
> +	}
> +	elt_data->comm = kzalloc(size, GFP_KERNEL);
> +	if (!elt_data->comm) {
> +		track_data_free(data);

It seems to leak 'elf_data' here.

Thanks,
Namhyung


> +		return ERR_PTR(-ENOMEM);
> +	}
> +
> +	data->elt.private_data = elt_data;
> +
> +	return data;
> +}

  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 14:34 [PATCH v3 0/7] tracing: Hist trigger snapshot and onchange additions Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 1/7] tracing: Refactor hist trigger action code Tom Zanussi
2018-08-10  6:58   ` Namhyung Kim
2018-08-10 14:05     ` Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 2/7] tracing: Split up onmatch action data Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 3/7] tracing: Generalize hist trigger onmax and save action Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 4/7] tracing: Add conditional snapshot Tom Zanussi
2018-08-10  7:02   ` Namhyung Kim
2018-08-10 14:05     ` Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 5/7] tracing: Move hist trigger key printing into a separate function Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 6/7] tracing: Add snapshot action Tom Zanussi
2018-08-10  7:04   ` Namhyung Kim [this message]
2018-08-10 14:07     ` Tom Zanussi
2018-08-09 14:34 ` [PATCH v3 7/7] tracing: Add hist trigger onchange() handler Tom Zanussi
2018-08-09 14:47 ` [PATCH v3 0/7] tracing: Hist trigger snapshot and onchange additions Steven Rostedt
2018-08-09 14:51   ` Tom Zanussi
2018-08-09 14:55     ` Steven Rostedt
2018-08-09 14:56       ` Tom Zanussi

Reply instructions:

You may reply publically 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=20180810070404.GD479@sejong \
    --to=namhyung@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=joel@joelfernandes.org \
    --cc=julia@ni.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vedang.patel@intel.com \
    --cc=zanussi@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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox