From 9b20e2437295d1e4c48ad6b5efe50148b3057205 Mon Sep 17 00:00:00 2001 From: Qi Zheng Date: Fri, 6 Dec 2024 19:23:48 +0800 Subject: [PATCH] mm-pgtable-reclaim-empty-pte-page-in-madvisemadv_dontneed-fix Dan Carpenter reported the following warning: Commit e3aafd2d3551 ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") from Dec 4, 2024 (linux-next), leads to the following Smatch static checker warning: mm/pt_reclaim.c:69 try_to_free_pte() error: uninitialized symbol 'ptl'. To fix it, assign an initial value of NULL to the ptl. Link: https://lkml.kernel.org/r/20241206112348.51570-1-zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-mm/224e6a4e-43b5-4080-bdd8-b0a6fb2f0853@stanley.mountain/ Cc: Andy Lutomirski Cc: Catalin Marinas Cc: Dave Hansen Cc: David Hildenbrand Cc: David Rientjes Cc: Hugh Dickins Cc: Jann Horn Cc: Lorenzo Stoakes Cc: Matthew Wilcox Cc: Mel Gorman Cc: Muchun Song Cc: Peter Xu Cc: Peter Zijlstra Cc: Will Deacon Cc: Zach O'Keefe Signed-off-by: Andrew Morton --- mm/pt_reclaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/pt_reclaim.c b/mm/pt_reclaim.c index 6540a3115dde..7e9455a18aae 100644 --- a/mm/pt_reclaim.c +++ b/mm/pt_reclaim.c @@ -36,7 +36,7 @@ void try_to_free_pte(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, struct mmu_gather *tlb) { pmd_t pmdval; - spinlock_t *pml, *ptl; + spinlock_t *pml, *ptl = NULL; pte_t *start_pte, *pte; int i;