From: Dan Carpenter <dan.carpenter@linaro.org>
To: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: linux-mm@kvack.org
Subject: [bug report] mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)
Date: Fri, 6 Dec 2024 13:46:27 +0300 [thread overview]
Message-ID: <224e6a4e-43b5-4080-bdd8-b0a6fb2f0853@stanley.mountain> (raw)
Hello Qi Zheng,
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'.
mm/pt_reclaim.c
35 void try_to_free_pte(struct mm_struct *mm, pmd_t *pmd, unsigned long addr,
36 struct mmu_gather *tlb)
37 {
38 pmd_t pmdval;
39 spinlock_t *pml, *ptl;
40 pte_t *start_pte, *pte;
41 int i;
42
43 pml = pmd_lock(mm, pmd);
44 start_pte = pte_offset_map_rw_nolock(mm, pmd, addr, &pmdval, &ptl);
45 if (!start_pte)
46 goto out_ptl;
ptl is uninitialized on error.
47 if (ptl != pml)
48 spin_lock_nested(ptl, SINGLE_DEPTH_NESTING);
49
50 /* Check if it is empty PTE page */
51 for (i = 0, pte = start_pte; i < PTRS_PER_PTE; i++, pte++) {
52 if (!pte_none(ptep_get(pte)))
53 goto out_ptl;
54 }
55 pte_unmap(start_pte);
56
57 pmd_clear(pmd);
58
59 if (ptl != pml)
60 spin_unlock(ptl);
61 spin_unlock(pml);
62
63 free_pte(mm, addr, tlb, pmdval);
64
65 return;
66 out_ptl:
67 if (start_pte)
68 pte_unmap_unlock(start_pte, ptl);
--> 69 if (ptl != pml)
^^^
Uninitialized variable
70 spin_unlock(pml);
71 }
regards,
dan carpenter
next reply other threads:[~2024-12-06 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 10:46 Dan Carpenter [this message]
2024-12-06 11:10 ` Qi Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=224e6a4e-43b5-4080-bdd8-b0a6fb2f0853@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.org \
--cc=zhengqi.arch@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox