* mmap, brk or case 4 below case 5 below
* mremap move:
* AAAA AAAA
- * PPPP NNNN PPPPNNNNXXXX
+ * PPPP XXXX PPPPNNNNXXXX
* might become might become
* PPPPPPPPPPPP 1 or PPPPPPPPPPPP 6 or
- * PPPPPPPPNNNN 2 or PPPPPPPPXXXX 7 or
- * PPPPNNNNNNNN 3 PPPPXXXXXXXX 8
+ * PPPPPPPPXXXX 2 or PPPPPPPPXXXX 7 or
+ * PPPPXXXXXXXX 3 PPPPXXXXXXXX 8
*
* It is important for case 8 that the vma NNNN overlapping the
* region AAAA is never going to extended over XXXX. Instead XXXX must
vma = next; /* case 3 */
vma_start = addr;
vma_end = next->vm_end;
- vma_pgoff = mid->vm_pgoff;
+ vma_pgoff = next->vm_pgoff;
err = 0;
if (mid != next) { /* case 8 */
+ vma_pgoff = mid->vm_pgoff;
remove = mid;
err = dup_anon_vma(next, mid);
}