On Fri, 22 Jan 2016, Mika Penttilä wrote:

> diff --git a/mm/memory.c b/mm/memory.c
> index 30991f8..9178ee6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1871,7 +1871,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);

This would be fine as a second patch in a 2-patch series.  The first patch 
should fix change_memory_common() for numpages == 0 by returning without 
ever calling this function and triggering the WARN_ON().  Let's fix the 
problem.

Reply via email to