linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm/damon: add access checking for hugetlb pages
Date: Thu, 6 Jan 2022 18:22:11 +0800	[thread overview]
Message-ID: <a1abbcb3-c9fb-89b9-7d9e-c94368d163a2@linux.alibaba.com> (raw)
In-Reply-To: <20220106091200.GA14564@kili>

Hi Dan,

On 1/6/2022 5:12 PM, Dan Carpenter wrote:
> Hello Baolin Wang,
> 
> The patch 86522923bb29: "mm/damon: add access checking for hugetlb
> pages" from Dec 30, 2021, leads to the following Smatch static
> checker warning:
> 
> 	mm/damon/vaddr.c:405 damon_hugetlb_mkold()
> 	warn: 'page' can't be NULL.
> 
> mm/damon/vaddr.c
>      398 static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
>      399                                 struct vm_area_struct *vma, unsigned long addr)
>      400 {
>      401         bool referenced = false;
>      402         pte_t entry = huge_ptep_get(pte);
>      403         struct page *page = pte_page(entry);
>      404
> --> 405         if (!page)
> 
> I don't think it makes sense to check "page" because we're already dead
> if pte_page() starts returning NULL.  Maybe check "entry"?

Thanks for reporting. Yes, no need to check the 'page' returned from 
pte_page(), and the entry already be checked before to make sure it is a 
valid and present entry. Thus I will send a fix patch to remove the 
redundant page checking. Thanks.


      reply	other threads:[~2022-01-06 10:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  9:12 Dan Carpenter
2022-01-06 10:22 ` Baolin Wang [this message]

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=a1abbcb3-c9fb-89b9-7d9e-c94368d163a2@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-mm@kvack.org \
    /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