linux-next: build failure after merge of the mm-unstable tree

Mark Brown posted 1 patch 4 days, 20 hours ago
linux-next: build failure after merge of the mm-unstable tree
Posted by Mark Brown 4 days, 20 hours ago
Hi all,

After merging the mm-unstable tree, today's linux-next build (x86_64
allmodconfig) failed like this:

/tmp/next/build/mm/khugepaged.c:1357:6: error: variable 'pte' is used uninitialized whenever 'if' condition is true
[-Werror,-Wsometimes-uninitialized]
 1357 |         if (result != SCAN_SUCCEED)
      |             ^~~~~~~~~~~~~~~~~~~~~~
/tmp/next/build/mm/khugepaged.c:1458:6: note: uninitialized use occurs here
 1458 |         if (pte)
      |             ^~~
/tmp/next/build/mm/khugepaged.c:1357:2: note: remove the 'if' if its condition is always false
 1357 |         if (result != SCAN_SUCCEED)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 1358 |                 goto out_up_write;
      |                 ~~~~~~~~~~~~~~~~~
/tmp/next/build/mm/khugepaged.c:1352:6: error: variable 'pte' is used uninitialized whenever 'if' condition is true
[-Werror,-Wsometimes-uninitialized]
 1352 |         if (result != SCAN_SUCCEED)
      |             ^~~~~~~~~~~~~~~~~~~~~~
/tmp/next/build/mm/khugepaged.c:1458:6: note: uninitialized use occurs here
 1458 |         if (pte)
      |             ^~~
/tmp/next/build/mm/khugepaged.c:1352:2: note: remove the 'if' if its condition is always false
 1352 |         if (result != SCAN_SUCCEED)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
 1353 |                 goto out_up_write;
      |                 ~~~~~~~~~~~~~~~~~
/tmp/next/build/mm/khugepaged.c:1296:12: note: initialize the variable 'pte' to silence this warning
 1296 |         pte_t *pte;
      |                   ^
      |                    = NULL
2 errors generated.

Caused by this diff:

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 8ffb47f1e8453..2837f12618583 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1293,7 +1293,7 @@ static enum scan_result collapse_huge_page(struct mm_struct *mm, unsigned long s
        const unsigned long end_addr = start_addr + (PAGE_SIZE << order);
        LIST_HEAD(compound_pagelist);
        pmd_t *pmd, _pmd;
-       pte_t *pte = NULL;
+       pte_t *pte;
        pgtable_t pgtable;
        struct folio *folio;
        spinlock_t *pmd_ptl, *pte_ptl;

which git annotate is getting very confused about the source of unless
it's a dropped commit.  I have reverted that hunk.
Re: linux-next: build failure after merge of the mm-unstable tree
Posted by Andrew Morton 4 days, 12 hours ago
On Wed, 3 Jun 2026 10:39:14 +0100 Mark Brown <broonie@kernel.org> wrote:

> After merging the mm-unstable tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> /tmp/next/build/mm/khugepaged.c:1357:6: error: variable 'pte' is used uninitialized whenever 'if' condition is true
> [-Werror,-Wsometimes-uninitialized]
>  1357 |         if (result != SCAN_SUCCEED)
>       |             ^~~~~~~~~~~~~~~~~~~~~~
> /tmp/next/build/mm/khugepaged.c:1458:6: note: uninitialized use occurs here
>  1458 |         if (pte)
>       |             ^~~
> /tmp/next/build/mm/khugepaged.c:1357:2: note: remove the 'if' if its condition is always false
>  1357 |         if (result != SCAN_SUCCEED)
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1358 |                 goto out_up_write;
>       |                 ~~~~~~~~~~~~~~~~~
> /tmp/next/build/mm/khugepaged.c:1352:6: error: variable 'pte' is used uninitialized whenever 'if' condition is true
> [-Werror,-Wsometimes-uninitialized]
>  1352 |         if (result != SCAN_SUCCEED)

Dunno, really - perhaps I fed you some intermediate state.  Everything
looks OK here so it should come good.