Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147300
b: refs/heads/master
c: 7730d86
h: refs/heads/master
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 6, 2009
1 parent f70f5dc commit 4a27de8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00f0ad73ac90e3fba8b4cbe4cf21b2fb9a56cb72
refs/heads/master: 7730d8655880f41f2ea519aca2ca6a1413dfd2c9
6 changes: 5 additions & 1 deletion trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,11 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
vma_size = vma->vm_end - vma->vm_start;
nr_pages = (vma_size / PAGE_SIZE) - 1;

if (nr_pages == 0 || !is_power_of_2(nr_pages))
/*
* If we have data pages ensure they're a power-of-two number, so we
* can do bitmasks instead of modulo.
*/
if (nr_pages != 0 && !is_power_of_2(nr_pages))
return -EINVAL;

if (vma_size != PAGE_SIZE * (1 + nr_pages))
Expand Down

0 comments on commit 4a27de8

Please sign in to comment.