fs/proc/task_mmu.c: cleanup the "tail_vma" horror in m_next()
authorOleg Nesterov <oleg@redhat.com>
Thu, 9 Oct 2014 22:25:30 +0000 (15:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Oct 2014 02:25:48 +0000 (22:25 -0400)
commit23d54837e4f3a44ad4514d5eae8245c2250217ff
tree086ff9b97bd790748e9da7798d6714cd8fca06f6
parent59b4bf12d4776c0e4f3fd5c02d942f3a0596da97
fs/proc/task_mmu.c: cleanup the "tail_vma" horror in m_next()

1. Kill the first "vma != NULL" check. Firstly this is not possible,
   m_next() won't be called if ->start() or the previous ->next()
   returns NULL.

   And if it was possible the 2nd "vma != tail_vma" check is buggy,
   we should not wrongly return ->tail_vma.

2. Make this function readable. The logic is very simple, we should
   return check "vma != tail" once and return "vm_next || tail_vma".

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/task_mmu.c