|
@@ -141,9 +141,10 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
|
|
|
for (; old_addr < old_end; old_addr += extent, new_addr += extent) {
|
|
|
cond_resched();
|
|
|
next = (old_addr + PMD_SIZE) & PMD_MASK;
|
|
|
- if (next - 1 > old_end)
|
|
|
- next = old_end;
|
|
|
+ /* even if next overflowed, extent below will be ok */
|
|
|
extent = next - old_addr;
|
|
|
+ if (extent > old_end - old_addr)
|
|
|
+ extent = old_end - old_addr;
|
|
|
old_pmd = get_old_pmd(vma->vm_mm, old_addr);
|
|
|
if (!old_pmd)
|
|
|
continue;
|