linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Zach O'Keefe <zokeefe@google.com>, Yang Shi <shy828301@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org,
	Zach O'Keefe <zokeefe@google.com>
Subject: Re: [PATCH 1/2] mm/khugepaged: Fix an uninitialized variable bug
Date: Fri, 20 Oct 2023 09:34:07 -0700	[thread overview]
Message-ID: <20231020093407.02be8ef4984ce31a7222f69f@linux-foundation.org> (raw)
In-Reply-To: <a1f3242f-1aae-4b46-9893-36b11ee0a6dd@moroto.mountain>

On Fri, 20 Oct 2023 17:13:32 +0300 Dan Carpenter <dan.carpenter@linaro.org> wrote:

> Smatch complains that "hpage" can be used uninitialized:
> 
>     mm/khugepaged.c:1234 collapse_huge_page()
>     error: uninitialized symbol 'hpage'.
> 
> Initialized it on this path.
> 
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1062,8 +1062,10 @@ static int alloc_charge_hpage(struct page **hpage, struct mm_struct *mm,
>  	int node = hpage_collapse_find_target_node(cc);
>  	struct folio *folio;
>  
> -	if (!hpage_collapse_alloc_folio(&folio, gfp, node, &cc->alloc_nmask))
> +	if (!hpage_collapse_alloc_folio(&folio, gfp, node, &cc->alloc_nmask)) {
> +		*hpage = NULL;
>  		return SCAN_ALLOC_HUGE_PAGE_FAIL;
> +	}
>  
>  	if (unlikely(mem_cgroup_charge(folio, mm, gfp))) {
>  		folio_put(folio);

Thanks.   Seems this was accidentally fixed by 

Author:     Peter Xu <peterx@redhat.com>
AuthorDate: Wed Feb 22 14:52:47 2023 -0500
Commit:     Andrew Morton <akpm@linux-foundation.org>
CommitDate: Tue Mar 28 16:20:06 2023 -0700

    mm/khugepaged: alloc_charge_hpage() take care of mem charge errors


Which was quite a long time ago.  Are you scanning old kernel versions?


  parent reply	other threads:[~2023-10-20 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 14:13 Dan Carpenter
2023-10-20 14:14 ` [PATCH 2/2] mm/khugepaged: Fix a NULL vs IS_ERR() bug in collapse_pte_mapped_thp() Dan Carpenter
2023-10-20 16:36   ` Andrew Morton
2023-10-20 16:49     ` Vishal Moola
2023-10-23  4:59       ` Dan Carpenter
2023-10-23 14:16         ` Dan Carpenter
2023-10-20 16:34 ` Andrew Morton [this message]
2023-10-23  4:57   ` [PATCH 1/2] mm/khugepaged: Fix an uninitialized variable bug Dan Carpenter

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=20231020093407.02be8ef4984ce31a7222f69f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=zokeefe@google.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