lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150701130942.GA14695@krava.brq.redhat.com>
Date:	Wed, 1 Jul 2015 15:09:42 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Taeung Song <treeze.taeung@...il.com>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	linux-kernel@...r.kernel.org, namhyung@...nel.org,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v3 4/5] perf mem: Fill in the missing freeing a session
 after an error occur

On Wed, Jul 01, 2015 at 08:59:48PM +0900, Taeung Song wrote:
> When an error occur a error value is just returned
> without freeing the session. So allocating and freeing
> session have to be matched as a pair even if an error occur.
> 
> Signed-off-by: Taeung Song <treeze.taeung@...il.com>
> ---
>  commit_msg               |  5 +++++
>  tools/perf/builtin-mem.c | 16 ++++++----------
>  2 files changed, 11 insertions(+), 10 deletions(-)
>  create mode 100644 commit_msg
> 
> diff --git a/commit_msg b/commit_msg
> new file mode 100644
> index 0000000..659c93f
> --- /dev/null
> +++ b/commit_msg
> @@ -0,0 +1,5 @@
> +perf kmem: Fill in the missing freeing a session after an error occur
> +
> +When an error occur a error value is just returned
> +without freeing the session. So allocating and freeing
> +session have to be matched as a pair even if an error occur.

extra file added ^^^, apart from that:

Acked-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka


> diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
> index da2ec06..80170aa 100644
> --- a/tools/perf/builtin-mem.c
> +++ b/tools/perf/builtin-mem.c
> @@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem)
>  		.mode = PERF_DATA_MODE_READ,
>  		.force = mem->force,
>  	};
> -	int err = -EINVAL;
>  	int ret;
>  	struct perf_session *session = perf_session__new(&file, false,
>  							 &mem->tool);
> @@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem)
>  	if (mem->cpu_list) {
>  		ret = perf_session__cpu_bitmap(session, mem->cpu_list,
>  					       mem->cpu_bitmap);
> -		if (ret)
> +		if (ret < 0)
>  			goto out_delete;
>  	}
>  
> -	if (symbol__init(&session->header.env) < 0)
> -		return -1;
> +	ret = symbol__init(&session->header.env);
> +	if (ret < 0)
> +		goto out_delete;
>  
>  	printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n");
>  
> -	err = perf_session__process_events(session);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	ret = perf_session__process_events(session);
>  
>  out_delete:
>  	perf_session__delete(session);
> -	return err;
> +	return ret;
>  }
>  
>  static int report_events(int argc, const char **argv, struct perf_mem *mem)
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ