Skip to content

Commit

Permalink
mm/memory.c: make apply_to_page_range() more robust
Browse files Browse the repository at this point in the history
Arm and arm64 used to trigger this BUG_ON() - this has now been fixed.

But a WARN_ON() here is sufficient to catch future buggy callers.

Signed-off-by: Mika Penttilä <mika.penttila@nextfour.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mika Penttilä authored and Linus Torvalds committed Mar 15, 2016
1 parent 4355c01 commit 9cb65bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,9 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
unsigned long end = addr + size;
int err;

BUG_ON(addr >= end);
if (WARN_ON(addr >= end))
return -EINVAL;

pgd = pgd_offset(mm, addr);
do {
next = pgd_addr_end(addr, end);
Expand Down

0 comments on commit 9cb65bc

Please sign in to comment.