[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200618003040.26360-1-gaurav1086@gmail.com>
Date: Wed, 17 Jun 2020 20:30:18 -0400
From: Gaurav Singh <gaurav1086@...il.com>
To: gaurav1086@...il.com, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel@...r.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM)
Subject: [PATCH] [perf] sort : Fix null pointer dereference in _hist_entry__sym_snprintf
The pointer ms can be NULL. Add null check before
dereferencing it to avoid segmentation fault.
Signed-off-by: Gaurav Singh <gaurav1086@...il.com>
---
tools/perf/util/sort.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index d42339df20f8..25c7c96893f6 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -294,6 +294,9 @@ static int _hist_entry__sym_snprintf(struct map_symbol *ms,
u64 ip, char level, char *bf, size_t size,
unsigned int width)
{
+ if (!ms)
+ return 0;
+
struct symbol *sym = ms->sym;
struct map *map = ms->map;
size_t ret = 0;
--
2.17.1
Powered by blists - more mailing lists