lkml.org 
[lkml]   [2014]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf bench: Fix NULL pointer dereference in "perf bench all"
Em Wed, Mar 12, 2014 at 06:40:51PM -0400, Patrick Palka escreveu:
> for_each_bench() must check that the "benchmarks" field of a collection
> is not NULL before dereferencing it because the "all" collection in
> particular has a NULL "benchmarks" field (signifying that it has no
> benchmarks to iterate over).
>
> This fixes a NULL pointer dereference when running "perf bench all".

Can you please mention against which tree you're fixing things? I just
tried to reproduce it here on perf/urgent and this problem is not
reproducible by simply running:

perf bench all

So now I'm going to try on perf/core, tip/master, etc :-\

- Arnaldo

> Signed-off-by: Patrick Palka <patrick@parcs.ath.cx>
> ---
> tools/perf/builtin-bench.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
> index e47f90c..8a987d2 100644
> --- a/tools/perf/builtin-bench.c
> +++ b/tools/perf/builtin-bench.c
> @@ -76,7 +76,7 @@ static struct collection collections[] = {
>
> /* Iterate over all benchmarks within a collection: */
> #define for_each_bench(coll, bench) \
> - for (bench = coll->benchmarks; bench->name; bench++)
> + for (bench = coll->benchmarks; bench && bench->name; bench++)
>
> static void dump_benchmarks(struct collection *coll)
> {
> --
> 1.9.0


\
 
 \ /
  Last update: 2014-03-14 13:01    [W:0.065 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site