]> git.baikalelectronics.ru Git - kernel.git/commit
mm: drop NULL return check of pte_offset_map_lock()
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Thu, 6 Jul 2017 22:39:26 +0000 (15:39 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Jul 2017 23:24:33 +0000 (16:24 -0700)
commite1bc23db4010000ff486f20366b7728826856508
treeca1f3b9e9ccba747519a47176ea2e7b5dbd33d55
parent97761292a1285abf1ed90ef2e44db093e8428167
mm: drop NULL return check of pte_offset_map_lock()

pte_offset_map_lock() finds and takes ptl, and returns pte.  But some
callers return without unlocking the ptl when pte == NULL, which seems
weird.

Git history said that !pte check in change_pte_range() was introduced in
commit 14d9a3dda8ee ("mm: numa: recheck for transhuge pages under lock
during protection changes") and still remains after commit a2bbb6f28510
("mm: mprotect: use pmd_trans_unstable instead of taking the pmd_lock")
which partially reverts 14d9a3dda8ee.  So I think that it's just dead
code.

Many other caller of pte_offset_map_lock() never check NULL return, so
let's do likewise.

Link: http://lkml.kernel.org/r/1495089737-1292-1-git-send-email-n-horiguchi@ah.jp.nec.com
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c
mm/mprotect.c