[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 3 Mar 2015 09:44:08 +0100
From: Ingo Molnar <mingo@...nel.org>
To: hpa@...or.com, ak@...ux.intel.com, acme@...hat.com,
kan.liang@...el.com, a.p.zijlstra@...llo.nl,
linux-kernel@...r.kernel.org, xiakaixu@...wei.com,
tglx@...utronix.de
Cc: linux-tip-commits@...r.kernel.org
Subject: Re: [tip:perf/core] Revert "perf: Remove the extra validity check on
nr_pages"
* tip-bot for Kan Liang <tipbot@...or.com> wrote:
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -4446,7 +4446,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
> * If we have rb pages ensure they're a power-of-two number, so we
> * can do bitmasks instead of modulo.
> */
> - if (!is_power_of_2(nr_pages))
> + if (nr_pages != 0 && !is_power_of_2(nr_pages))
> return -EINVAL;
Hm, what does is_power_of_2(0) return? It should return 0, because 0
is not a power of 2!
and if it's fixed to return 0, then the check should properly be
something like:
if (!nr_pages || !is_power_of_2(nr_pages))
or so?
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists