Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218545

[PATCH V8 4/7] perf,tools: fix dump_sample crash when evsel is NULL.

From kan.liang@intel.com
Newsgroups linux.kernel
Subject [PATCH V8 4/7] perf,tools: fix dump_sample crash when evsel is NULL.
Date 2015-09-03 21:50 +0200
Message-ID <q4IGf-4OA-27@gated-at.bofh.it> (permalink)
References <q4IGe-4OA-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kan Liang <kan.liang@intel.com>

Need to check evsel before using in dump_sample.

Signed-off-by: Kan Liang <kan.liang@intel.com>
---
 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V8 0/7] Freq/CPU%/CORE_BUSY% support kan.liang@intel.com - 2015-09-03 21:50 +0200
  [PATCH V8 7/7] perf,tools: Show freq/CPU%/CORE_BUSY% in perf report --stdio kan.liang@intel.com - 2015-09-03 21:50 +0200
  [PATCH V8 4/7] perf,tools: fix dump_sample crash when evsel is NULL. kan.liang@intel.com - 2015-09-03 21:50 +0200
  [PATCH V8 2/7] perf,tools: read msr pmu type from header. kan.liang@intel.com - 2015-09-03 21:50 +0200

csiph-web