[PATCH V8 4/7] perf,tools: fix dump_sample crash when evsel is NULL.
From: kan . liang
Date: Thu Sep 03 2015 - 15:49:24 EST
From: Kan Liang <kan.liang@xxxxxxxxx>
Need to check evsel before using in dump_sample.
Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
---
tools/perf/util/session.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 61669be..23fed17 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1080,11 +1080,11 @@ static int machines__deliver_event(struct machines *machines,
switch (event->header.type) {
case PERF_RECORD_SAMPLE:
- dump_sample(evsel, event, sample);
if (evsel == NULL) {
++evlist->stats.nr_unknown_id;
return 0;
}
+ dump_sample(evsel, event, sample);
if (machine == NULL) {
++evlist->stats.nr_unprocessable_samples;
return 0;
--
1.8.3.1
--
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/