diff options
author | David Ahern <dsahern@gmail.com> | 2013-11-12 09:46:53 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-12 14:30:54 -0500 |
commit | 8973504be70b2986a2081eeff7d9a4210dec295d (patch) | |
tree | ac388c9ef74a7de7e21148a835f7b9028b46c62d /tools/perf | |
parent | fd2eabaf16984bc75695e43f4b76e6f20ed4ea41 (diff) |
perf record: Fix segfault with --no-mmap-pages
Adrian reported a segfault when using --no-out-pages:
$ tools/perf/perf record -vv --no-out-pages uname
Segmentation fault (core dumped)
The same occurs with --no-mmap-pages. Fix by checking that str is
non-NULL before parsing it.
Signed-off-by: David Ahern <dsahern@gmail.com>
Reported-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1384267617-3446-2-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/evlist.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 99dc58e5dcc3..3960560f873a 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -719,6 +719,9 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str, | |||
719 | { .tag = 0 }, | 719 | { .tag = 0 }, |
720 | }; | 720 | }; |
721 | 721 | ||
722 | if (str == NULL) | ||
723 | return -1; | ||
724 | |||
722 | val = parse_tag_value(str, tags); | 725 | val = parse_tag_value(str, tags); |
723 | if (val != (unsigned long) -1) { | 726 | if (val != (unsigned long) -1) { |
724 | /* we got file size value */ | 727 | /* we got file size value */ |