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]
Date:   Thu, 30 Apr 2020 11:04:23 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Clark Williams <williams@...hat.com>,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Song Liu <songliubraving@...com>
Subject: Re: [PATCH 3/8] perf bpf: Decouple creating the evlist from adding
 the SB event

On Wed, Apr 29, 2020 at 10:11:01AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> -int perf_evlist__add_sb_event(struct evlist **evlist,
> +int perf_evlist__add_sb_event(struct evlist *evlist,
>  			      struct perf_event_attr *attr,
>  			      perf_evsel__sb_cb_t cb,
>  			      void *data)
>  {
>  	struct evsel *evsel;
> -	bool new_evlist = (*evlist) == NULL;
> -
> -	if (*evlist == NULL)
> -		*evlist = evlist__new();
> -	if (*evlist == NULL)
> -		return -1;
>  
>  	if (!attr->sample_id_all) {
>  		pr_warning("enabling sample_id_all for all side band events\n");
>  		attr->sample_id_all = 1;
>  	}
>  
> -	evsel = perf_evsel__new_idx(attr, (*evlist)->core.nr_entries);
> +	evsel = perf_evsel__new_idx(attr, evlist->core.nr_entries);
>  	if (!evsel)
>  		goto out_err;

we can return -1 right here

jirka

>  
>  	evsel->side_band.cb = cb;
>  	evsel->side_band.data = data;
> -	evlist__add(*evlist, evsel);
> +	evlist__add(evlist, evsel);
>  	return 0;
> -
>  out_err:
> -	if (new_evlist) {
> -		evlist__delete(*evlist);
> -		*evlist = NULL;
> -	}
>  	return -1;
>  }
>  
> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
> index f5bd5c386df1..0f02408fff3e 100644
> --- a/tools/perf/util/evlist.h
> +++ b/tools/perf/util/evlist.h
> @@ -107,7 +107,7 @@ int __perf_evlist__add_default_attrs(struct evlist *evlist,
>  
>  int perf_evlist__add_dummy(struct evlist *evlist);
>  
> -int perf_evlist__add_sb_event(struct evlist **evlist,
> +int perf_evlist__add_sb_event(struct evlist *evlist,
>  			      struct perf_event_attr *attr,
>  			      perf_evsel__sb_cb_t cb,
>  			      void *data);
> -- 
> 2.21.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ