[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191112054946.5869-1-ravi.bangoria@linux.ibm.com>
Date: Tue, 12 Nov 2019 11:19:46 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: acme@...nel.org
Cc: jolsa@...hat.com, kan.liang@...el.com,
linux-kernel@...r.kernel.org,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Subject: [PATCH] perf report: Fix segfault with '-F phys_daddr'
If perf.data file is not recorded with mem-info, adding 'phys_daddr'
to output field in perf report results in segfault. Fix that.
Before:
$ ./perf record ls
$ ./perf report -F +phys_daddr
Segmentation fault (core dumped)
After:
$ ./perf report -F +phys_daddr
Samples: 11 of event 'cycles:u', Event count (approx.): 1485821
Overhead Data Physical Address Command Shared Object Symbol
22.57% [.] 0000000000000000 ls libc-2.29.so [.] __strcoll_l
21.87% [.] 0000000000000000 ls ld-2.29.so [.] _dl_relocate_object
...
Fixes: 8780fb25ab06 ("perf sort: Add sort option for physical address")
Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
---
tools/perf/util/sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 43d1d410854a..c2430676e569 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1413,7 +1413,7 @@ static int hist_entry__phys_daddr_snprintf(struct hist_entry *he, char *bf,
size_t ret = 0;
size_t len = BITS_PER_LONG / 4;
- addr = he->mem_info->daddr.phys_addr;
+ addr = he->mem_info ? he->mem_info->daddr.phys_addr : 0;
ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", he->level);
--
2.21.0
Powered by blists - more mailing lists