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:	Mon, 14 Sep 2015 18:36:27 -0300
From:	Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To:	Raphaël Beamonte <raphael.beamonte@...il.com>
Cc:	Jiri Olsa <jolsa@...hat.com>, Jiri Olsa <jolsa@...nel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Matt Fleming <matt@...eblueprint.co.uk>
Subject: Re: [PATCH 4/5] perf tools: Propagate error info from tp_format

Em Mon, Sep 14, 2015 at 04:59:41PM -0400, Raphaël Beamonte escreveu:
> 2015-09-14 16:53 GMT-04:00 Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>:
> > +++ b/tools/perf/util/evsel.c
> > @@ -234,7 +234,9 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int
> >         struct perf_evsel *evsel = zalloc(perf_evsel__object.size);
> >         int err = -ENOMEM;
> >
> > -       if (evsel != NULL) {
> > +       if (evsel == NULL) {
> > +               goto out_err;
> > +       } else {
> 
> Is the else really necessary after a goto?

Not really, we can remove it and all would be equivalent (the code
with/without should be the same), its just that I wanted to avoid
touching the identation to reduce patch size and since we need o open a
brace to declare that attr variable...

- Arnaldo
 
> >                 struct perf_event_attr attr = {
> >                         .type          = PERF_TYPE_TRACEPOINT,
> >                         .sample_type   = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME |
> > @@ -261,6 +263,7 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int
> >  out_free:
> >         zfree(&evsel->name);
> >         free(evsel);
> > +out_err:
> >         return ERR_PTR(err);
> >  }
> >
> > diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
> > index 8e3a60e3e15f..802bb868d446 100644
> > --- a/tools/perf/util/trace-event.c
> > +++ b/tools/perf/util/trace-event.c
> > @@ -100,7 +100,7 @@ struct event_format*
> >  trace_event__tp_format(const char *sys, const char *name)
> >  {
> >         if (!tevent_initialized && trace_event__init2())
> > -               return NULL;
> > +               return ERR_PTR(-ENOMEM);
> >
> >         return tp_format(sys, name);
> >  }
--
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