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: <20190815125101.GE30356@krava>
Date:   Thu, 15 Aug 2019 14:51:01 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Mamatha Inamdar <mamatha4@...ux.vnet.ibm.com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com,
        namhyung@...nel.org, kstewart@...uxfoundation.org,
        gregkh@...uxfoundation.org, jeremie.galarneau@...icios.com,
        shawn@....icu, tstoyanov@...are.com, tglx@...utronix.de,
        alexey.budankov@...ux.intel.com, adrian.hunter@...el.com,
        songliubraving@...com, ravi.bangoria@...ux.ibm.com
Subject: Re: [PATCH]Perf: Return error code for perf_session__new function on
 failure

On Wed, Aug 14, 2019 at 03:02:18PM +0530, Mamatha Inamdar wrote:

SNIP

>  #ifdef HAVE_ZSTD_SUPPORT
>  static int perf_session__process_compressed_event(struct perf_session *session,
> @@ -181,6 +182,7 @@ static int ordered_events__deliver_event(struct ordered_events *oe,
>  struct perf_session *perf_session__new(struct perf_data *data,
>  				       bool repipe, struct perf_tool *tool)
>  {
> +	int ret = 0;

hum, should ret be initialized to -ENOMEM instead?

jirka

>  	struct perf_session *session = zalloc(sizeof(*session));
>  
>  	if (!session)
> @@ -195,13 +197,15 @@ struct perf_session *perf_session__new(struct perf_data *data,
>  
>  	perf_env__init(&session->header.env);
>  	if (data) {
> -		if (perf_data__open(data))
> +		ret = perf_data__open(data);
> +		if (ret < 0)
>  			goto out_delete;
>  
>  		session->data = data;
>  
>  		if (perf_data__is_read(data)) {
> -			if (perf_session__open(session) < 0)
> +			ret = perf_session__open(session);
> +			if (ret < 0)
>  				goto out_delete;
>  
>  			/*
> @@ -216,7 +220,8 @@ struct perf_session *perf_session__new(struct perf_data *data,
>  			perf_evlist__init_trace_event_sample_raw(session->evlist);
>  
>  			/* Open the directory data. */
> -			if (data->is_dir && perf_data__open_dir(data))
> +			ret = data->is_dir && perf_data__open_dir(data);
> +			if (ret)
>  				goto out_delete;
>  		}
>  	} else  {
> @@ -250,7 +255,7 @@ struct perf_session *perf_session__new(struct perf_data *data,
>   out_delete:
>  	perf_session__delete(session);
>   out:
> -	return NULL;
> +	return ERR_PTR(ret);
>  }
>  
>  static void perf_session__delete_threads(struct perf_session *session)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ