From 02417e0a91f10b4bac54cc670f2108ef00f4f18c Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Tue, 28 Feb 2023 18:27:19 -0800 Subject: [PATCH] mm/mmap: remove unnecessary vp->vma check in vma_prepare vp->vma in vma_prepare() is always non-NULL, therefore checking it is not necessary. Remove the extra check. Link: https://lkml.kernel.org/r/20230301022720.1380780-1-surenb@google.com Fixes: e8f071350ea5 ("mm/mmap: write-lock VMAs in vma_prepare before modifying them") Signed-off-by: Suren Baghdasaryan Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/202302281802.J93Nma7q-lkp@intel.com/ Reviewed-by: David Hildenbrand Reviewed-by: Liam R. Howlett Cc: David Howells Cc: Hugh Dickins Cc: Jason Gunthorpe Cc: Laurent Dufour Cc: Mathieu Desnoyers Cc: Matthew Wilcox Cc: Pavel Tatashin Cc: Stephen Rothwell Cc: Yu Zhao Signed-off-by: Andrew Morton --- mm/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index dcf3aed25227..deeafe39e06b 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -502,8 +502,7 @@ static inline void init_vma_prep(struct vma_prepare *vp, */ static inline void vma_prepare(struct vma_prepare *vp) { - if (vp->vma) - vma_start_write(vp->vma); + vma_start_write(vp->vma); if (vp->adj_next) vma_start_write(vp->adj_next); /* vp->insert is always a newly created VMA, no need for locking */ -- 2.50.1