From 8e50d384cc1d5afd2989cf0f7093756ed7164eb2 Mon Sep 17 00:00:00 2001 From: Zhouyi Zhou Date: Thu, 24 Oct 2013 15:43:33 +0800 Subject: perf tools: Fixup mmap event consumption The tail position of the event buffer should only be modified after actually use that event. If not the event buffer could be invalid before use, and segment fault occurs when invoking perf top -G. Signed-off-by: Zhouyi Zhou Cc: David Ahern Cc: Zhouyi Zhou Link: http://lkml.kernel.org/r/1382600613-32177-1-git-send-email-zhouzhouyi@gmail.com [ Simplified the logic using exit gotos and renamed write_tail method to mmap_consume ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/perf-record.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/tests/perf-record.c') diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index b8a7056519ac..7923b06ffc91 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c @@ -263,6 +263,8 @@ int test__PERF_RECORD(void) type); ++errs; } + + perf_evlist__mmap_consume(evlist, i); } } -- cgit v1.2.3-59-g8ed1b