]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/huge_memory.c: fix used-uninitialized
authorAndrew Morton <akpm@linux-foundation.org>
Tue, 25 Jun 2024 21:51:36 +0000 (14:51 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:16 +0000 (19:30 -0700)
Fix used-uninitialized of `page'.

Fixes: dce7d10be4bb ("mm/madvise: optimize lazyfreeing with mTHP in madvise_free")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406260514.SLhNM9kQ-lkp@intel.com
Cc: Lance Yang <ioworker0@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/huge_memory.c

index 18bcd7672a89b9f2bb25c1d8b8e34e7f3d1ad760..46ba81240d9694c655e0914b2c2726aeb4d90efc 100644 (file)
@@ -2696,7 +2696,6 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
        struct mm_struct *mm = vma->vm_mm;
        int ref_count, map_count;
        pmd_t orig_pmd = *pmdp;
-       struct page *page;
 
        if (folio_test_dirty(folio) || pmd_dirty(orig_pmd))
                return false;
@@ -2732,7 +2731,7 @@ static bool __discard_anon_folio_pmd_locked(struct vm_area_struct *vma,
                return false;
        }
 
-       folio_remove_rmap_pmd(folio, page, vma);
+       folio_remove_rmap_pmd(folio, pmd_page(orig_pmd), vma);
        zap_deposited_table(mm, pmdp);
        add_mm_counter(mm, MM_ANONPAGES, -HPAGE_PMD_NR);
        if (vma->vm_flags & VM_LOCKED)