diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evlist.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 3960560f873a..fb4727d3df85 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -710,7 +710,6 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str, { unsigned int *mmap_pages = opt->value; unsigned long pages, val; - size_t size; static struct parse_tag tags[] = { { .tag = 'B', .mult = 1 }, { .tag = 'K', .mult = 1 << 10 }, @@ -726,11 +725,6 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str, if (val != (unsigned long) -1) { /* we got file size value */ pages = PERF_ALIGN(val, page_size) / page_size; - if (pages < (1UL << 31) && !is_power_of_2(pages)) { - pages = next_pow2(pages); - pr_info("rounding mmap pages size to %lu (%lu pages)\n", - pages * page_size, pages); - } } else { /* we got pages count value */ char *eptr; @@ -741,14 +735,14 @@ 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; + if (pages < (1UL << 31) && !is_power_of_2(pages)) { + pages = next_pow2(pages); + pr_info("rounding mmap pages size to %lu bytes (%lu pages)\n", + pages * page_size, pages); } - size = perf_evlist__mmap_size(pages); - if (!size) { - pr_err("--mmap_pages/-m value must be a power of two."); + if (pages > UINT_MAX || pages > SIZE_MAX / page_size) { + pr_err("--mmap_pages/-m value too big\n"); return -1; } |