summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evlist.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-10-24 08:48:11 +0200
committerIngo Molnar <mingo@kernel.org>2013-10-24 08:48:11 +0200
commit2f5e98802350627ad6f2e3cee4d177059fc0c2f2 (patch)
treed4bbd2fadb55737c20e96ed0f2db9101c9ba24a0 /tools/perf/util/evlist.c
parentaa30a2e03a453aad9fd96c3f2d4a82c3497674e5 (diff)
parentc1fb5651bb40f9efaf32d280f39e06df7e352673 (diff)
downloadtalos-obmc-linux-2f5e98802350627ad6f2e3cee4d177059fc0c2f2.tar.gz
talos-obmc-linux-2f5e98802350627ad6f2e3cee4d177059fc0c2f2.zip
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: * Show progress on histogram collapsing, that can take a long time, from Namhyung Kim. * Support "$vars" meta argument syntax for local variables, allowing asking for all possible variables at a given probe point to be collected when it hits, from Masami Hiramatsu. * Address the root cause of that 'perf sched' stack initialization build slowdown, by programmatically setting a big array after moving the global variable back to the stack. Fix from Adrian Hunter. * Do not repipe attributes to a perf.data file in 'perf inject', fix from Adrian Hunter * Change the procps visible command-name of invididual benchmark tests plus cleanups, from Ingo Molnar. * Do not accept parse_tag_value() overflow, fix from Adrian Hunter. * Validate that mmap_pages is not too big. From Adrian Hunter. * Fix non-debug build, from Adrian Hunter. * Clarify the "sample parsing" test entry, from Arnaldo Carvalho de Melo. * Consider PERF_SAMPLE_TRANSACTION in the "sample parsing" test, from Arnaldo Carvalho de Melo. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r--tools/perf/util/evlist.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 85c4c80bcac8..2ce92eceb424 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -698,7 +698,8 @@ static size_t perf_evlist__mmap_size(unsigned long pages)
int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
int unset __maybe_unused)
{
- unsigned int pages, val, *mmap_pages = opt->value;
+ unsigned int *mmap_pages = opt->value;
+ unsigned long pages, val;
size_t size;
static struct parse_tag tags[] = {
{ .tag = 'B', .mult = 1 },
@@ -709,12 +710,12 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
};
val = parse_tag_value(str, tags);
- if (val != (unsigned int) -1) {
+ if (val != (unsigned long) -1) {
/* we got file size value */
pages = PERF_ALIGN(val, page_size) / page_size;
- if (!is_power_of_2(pages)) {
+ if (pages < (1UL << 31) && !is_power_of_2(pages)) {
pages = next_pow2(pages);
- pr_info("rounding mmap pages size to %u (%u pages)\n",
+ pr_info("rounding mmap pages size to %lu (%lu pages)\n",
pages * page_size, pages);
}
} else {
@@ -727,6 +728,11 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
}
}
+ if (pages > UINT_MAX || pages > SIZE_MAX / page_size) {
+ pr_err("--mmap_pages/-m value too big\n");
+ return -1;
+ }
+
size = perf_evlist__mmap_size(pages);
if (!size) {
pr_err("--mmap_pages/-m value must be a power of two.");
OpenPOWER on IntegriCloud