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:	Wed, 2 Sep 2015 14:46:16 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	pi3orama <pi3orama@....com>
Cc:	"Wangnan (F)" <wangnan0@...wei.com>,
	"masami.hiramatsu.pt@...achi.com" <masami.hiramatsu.pt@...achi.com>,
	"acme@...hat.com" <acme@...hat.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Zefan Li <lizefan@...wei.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf tools: Don't write to evsel if parser doesn't
 collect evsel

On Wed, Sep 02, 2015 at 08:05:54PM +0800, pi3orama wrote:

SNIP

> >>>        perf_evlist__splice_list_tail(evlist, &data.list, entries);
> >>>        evlist->nr_groups += data.nr_groups;
> >>> -        last = perf_evlist__last(evlist);
> >>> -        last->cmdline_group_boundary = true;
> >>>        return 0;
> >>>    }
> >>> @@ -1252,7 +1262,13 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
> >>>    struct perf_evsel *last = NULL;
> >>>    int err;
> >>> -    if (evlist->nr_entries > 0)
> >>> +    /*
> >>> +     * Don't return when list_empty, give func a chance to report
> >>> +     * error when it found last == NULL.
> >>> +     *
> >>> +     * So no need to WARN here, let *func do this.
> >>> +     */
> >>> +    if (!list_empty(&evlist->entries))
> > 
> > why is it better than to check evlist->nr_entries?
> > evlist->nr_entries is equivalent to !list_empty(&evlist->entries) in here, right?
> > 
> 
> By checking list we won't rely on the assumption that nr_entries reflects the
> actual number of elements in that list, makes the logic of this code more compact.
> Don't you think so?
> 
> At this point they are equivalent, but the whole patch is preventive action.

ok, fair enough ;-)

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

thanks,
jirka
--
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