[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220322221517.2510440-11-eranian@google.com>
Date: Tue, 22 Mar 2022 15:15:14 -0700
From: Stephane Eranian <eranian@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, kim.phillips@....com, acme@...hat.com,
jolsa@...hat.com, songliubraving@...com, rafael@...nel.org,
ravi.bangoria@....com, sandipan.das@....com
Subject: [PATCH v7 10/13] perf tools: fix NULL point in evsel__env()
evsel_env() cannot return NULL. In case evsel->evlist->env is NULL default
to perf_env. Fixes crashes in evsel__open_strerror()
Signed-off-by: Ravi Bangoria <ravi.bangoria@....com>
Reviewed-by: Stephane Eranian <eranian@...gle.com>
---
tools/perf/util/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 22d3267ce294..14b0e7ffa2c7 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2965,7 +2965,7 @@ int evsel__open_strerror(struct evsel *evsel, struct target *target,
struct perf_env *evsel__env(struct evsel *evsel)
{
- if (evsel && evsel->evlist)
+ if (evsel && evsel->evlist && evsel->evlist->env)
return evsel->evlist->env;
return &perf_env;
}
--
2.35.1.894.gb6a874cedc-goog
Powered by blists - more mailing lists