fs/proc/task_mmu.c: simplify m_start() to make it readable
authorOleg Nesterov <oleg@redhat.com>
Thu, 9 Oct 2014 22:25:36 +0000 (15:25 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Oct 2014 02:25:49 +0000 (22:25 -0400)
commit0c255321f879c36bd74f58f9c7ed235ea6b919cb
tree36492e5b8edf09b1afd0f4a898d6acaa2b948ad9
parentebb6cdde1a50c3cd2a0a4668dfb571ecb3213449
fs/proc/task_mmu.c: simplify m_start() to make it readable

Now that m->version is gone we can cleanup m_start(). In particular,

  - Remove the "unsigned long" typecast, m->index can't be negative
    or exceed ->map_count. But lets use "unsigned int pos" to make
    it clear that "pos < map_count" is safe.

  - Remove the unnecessary "vma != NULL" check in the main loop. It
    can't be NULL unless we have a vm bug.

  - This also means that "pos < map_count" case can simply return the
    valid vma and avoid "goto" and subsequent checks.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: 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