From: Liam R. Howlett Date: Mon, 4 Jan 2021 19:44:45 +0000 (-0500) Subject: fs/coredump: Use maple tree iterators in place of linked list X-Git-Tag: howlett/maple_spf/20210128~29 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=143672eee07795c53cad8f2a6dcd11a2fbd24f54;p=users%2Fjedix%2Flinux-maple.git fs/coredump: Use maple tree iterators in place of linked list Signed-off-by: Liam R. Howlett --- diff --git a/fs/coredump.c b/fs/coredump.c index a2f6ecc8e345..eeea0c76eee4 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1038,10 +1038,10 @@ whole: return vma->vm_end - vma->vm_start; } -static struct vm_area_struct *first_vma(struct task_struct *tsk, +static struct vm_area_struct *first_vma(struct mm_struct *mm, struct vm_area_struct *gate_vma) { - struct vm_area_struct *ret = tsk->mm->mmap; + struct vm_area_struct *ret = find_vma(mm, 0); if (ret) return ret; @@ -1052,12 +1052,13 @@ static struct vm_area_struct *first_vma(struct task_struct *tsk, * Helper function for iterating across a vma list. It ensures that the caller * will visit `gate_vma' prior to terminating the search. */ -static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma, +static struct vm_area_struct *next_vma(struct mm_struct *mm, + struct vm_area_struct *this_vma, struct vm_area_struct *gate_vma) { struct vm_area_struct *ret; - ret = this_vma->vm_next; + ret = vma_next(mm, this_vma); if (ret) return ret; if (this_vma == gate_vma) @@ -1095,8 +1096,8 @@ int dump_vma_snapshot(struct coredump_params *cprm, int *vma_count, return -ENOMEM; } - for (i = 0, vma = first_vma(current, gate_vma); vma != NULL; - vma = next_vma(vma, gate_vma), i++) { + for (i = 0, vma = first_vma(mm, gate_vma); vma != NULL; + vma = next_vma(mm, vma, gate_vma), i++) { struct core_vma_metadata *m = (*vma_meta) + i; m->start = vma->vm_start;