summaryrefslogtreecommitdiffstats
path: root/mm/damon/vaddr.c
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linux.alibaba.com>2022-03-22 14:48:43 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-22 15:57:12 -0700
commit242e10a09f2637f61356a739ea9ed69235a47ce5 (patch)
tree3bdee14c010d58ba826bb348fcd89b1e53102ffb /mm/damon/vaddr.c
parent1971bd630452e943380429336a851c55b027eed1 (diff)
downloadlinux-242e10a09f2637f61356a739ea9ed69235a47ce5.tar.gz
linux-242e10a09f2637f61356a739ea9ed69235a47ce5.tar.bz2
linux-242e10a09f2637f61356a739ea9ed69235a47ce5.zip
mm/damon: remove redundant page validation
It will never get a NULL page by pte_page() as discussed in thread [1], thus remove the redundant page validation to fix below Smatch static checker warning. mm/damon/vaddr.c:405 damon_hugetlb_mkold() warn: 'page' can't be NULL. [1] https://lore.kernel.org/linux-mm/20220106091200.GA14564@kili/ Link: https://lkml.kernel.org/r/6d32f7d201b8970d53f51b6c5717d472aed2987c.1642386715.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: SeongJae Park <sj@kernel.org> Acked-by: David Rientjes <rientjes@google.com> Acked-by: Souptick Joarder <jrdr.linux@gmail.com> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/damon/vaddr.c')
-rw-r--r--mm/damon/vaddr.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index f98edb90a873..6d3454dd3204 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -402,9 +402,6 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
pte_t entry = huge_ptep_get(pte);
struct page *page = pte_page(entry);
- if (!page)
- return;
-
get_page(page);
if (pte_young(entry)) {
@@ -564,9 +561,6 @@ static int damon_young_hugetlb_entry(pte_t *pte, unsigned long hmask,
goto out;
page = pte_page(entry);
- if (!page)
- goto out;
-
get_page(page);
if (pte_young(entry) || !page_is_idle(page) ||