[tip:perf/core] perf tools: Fix wrong condition for allocation failure

From: tip-bot for Jiri Olsa
Date: Sat Jul 05 2014 - 06:42:53 EST


Commit-ID: d180ac14a95d738c2d2622db82c2212a8f998200
Gitweb: http://git.kernel.org/tip/d180ac14a95d738c2d2622db82c2212a8f998200
Author: Jiri Olsa <jolsa@xxxxxxxxxx>
AuthorDate: Fri, 20 Jun 2014 10:56:34 +0200
Committer: Jiri Olsa <jolsa@xxxxxxxxxx>
CommitDate: Fri, 27 Jun 2014 11:14:54 +0200

perf tools: Fix wrong condition for allocation failure

Check real allocated pointer for NULL.

Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-5rfzbalwjphmdzzil74eazyl@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-stat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 65a151e..3e80aa1 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -184,7 +184,7 @@ static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
{
evsel->priv = zalloc(sizeof(struct perf_stat));
- if (evsel == NULL)
+ if (evsel->priv == NULL)
return -ENOMEM;
perf_evsel__reset_stat_priv(evsel);
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/