From: Ramkumar Ramachandra Date: Thu, 27 Mar 2014 23:50:19 +0000 (-0400) Subject: perf bench: Fix segfault at the end of an 'all' execution X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5673872d4afd2584e075cf2b1adb2cccec46a0f3;p=linux-beck.git perf bench: Fix segfault at the end of an 'all' execution At the end of $ perf bench all the program segfaults because it attempts to dereference a NULL pointer. Fix this fault. Signed-off-by: Ramkumar Ramachandra Cc: Arnaldo Carvalho de Melo Cc: David Ahern Cc: Jiri Olsa Link: http://lkml.kernel.org/r/1395964219-22173-4-git-send-email-artagnon@gmail.com Signed-off-by: Jiri Olsa --- diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index f600b74216da..1e6e77710545 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c @@ -86,7 +86,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) {