diff --git a/include/linux/mm.h b/include/linux/mm.h index 15d93dff908e..16155e7351e4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -529,6 +529,11 @@ struct vm_operations_struct { unsigned long addr); }; +static inline void INIT_VMA(struct vm_area_struct *vma) +{ + INIT_LIST_HEAD(&vma->anon_vma_chain); +} + static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) { static const struct vm_operations_struct dummy_vm_ops = {}; @@ -536,7 +541,7 @@ static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) memset(vma, 0, sizeof(*vma)); vma->vm_mm = mm; vma->vm_ops = &dummy_vm_ops; - INIT_LIST_HEAD(&vma->anon_vma_chain); + INIT_VMA(vma); } static inline void vma_set_anonymous(struct vm_area_struct *vma) diff --git a/kernel/fork.c b/kernel/fork.c index f89e8c85f2b8..33496e0cdcff 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -359,7 +359,7 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig) if (new) { *new = *orig; - INIT_LIST_HEAD(&new->anon_vma_chain); + INIT_VMA(new); } return new; }