On 12/01/2024 10:14, Kefeng Wang wrote: > > > On 2024/1/12 13:03, kernel test robot wrote: >> Hi Matthew, >> >> kernel test robot noticed the following build warnings: >> >> [auto build test WARNING on akpm-mm/mm-everything] >> >> url: >> https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/mm-Add-pfn_swap_entry_folio/20240111-232757 >> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything >> patch link: >> https://lore.kernel.org/r/20240111152429.3374566-9-willy%40infradead.org >> patch subject: [PATCH v3 08/10] mm: Convert to should_zap_page() to >> should_zap_folio() >> config: arm-milbeaut_m10v_defconfig >> (https://download.01.org/0day-ci/archive/20240112/202401121250.A221BL2D-lkp@xxxxxxxxx/config) >> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git >> ae42196bc493ffe877a7e3dff8be32035dea4d07) >> reproduce (this is a W=1 build): >> (https://download.01.org/0day-ci/archive/20240112/202401121250.A221BL2D-lkp@xxxxxxxxx/reproduce) >> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of >> the same patch/commit), kindly add following tags >> | Reported-by: kernel test robot <lkp@xxxxxxxxx> >> | Closes: >> https://lore.kernel.org/oe-kbuild-all/202401121250.A221BL2D-lkp@xxxxxxxxx/ >> >> All warnings (new ones prefixed by >>): >> >>>> mm/memory.c:1451:8: warning: variable 'folio' is used uninitialized whenever >>>> 'if' condition is false [-Wsometimes-uninitialized] >> if (page) >> ^~~~ >> mm/memory.c:1454:44: note: uninitialized use occurs here >> if (unlikely(!should_zap_folio(details, folio))) >> ^~~~~ >> include/linux/compiler.h:77:42: note: expanded from macro 'unlikely' >> # define unlikely(x) __builtin_expect(!!(x), 0) >> ^ >> mm/memory.c:1451:4: note: remove the 'if' if its condition is always true >> if (page) >> ^~~~~~~~~ >> mm/memory.c:1438:22: note: initialize the variable 'folio' to silence this >> warning >> struct folio *folio; >> ^ >> = NULL > > Hi Andrew, please help to squash following change, thanks. I just independently found this issue during coincidental review of the code. It's still a problem in mm-unstable, so wondered if you missed the request, Andrew? > > diff --git a/mm/memory.c b/mm/memory.c > index 998237b5600f..5e88d5379127 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -1435,7 +1435,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, > arch_enter_lazy_mmu_mode(); > do { > pte_t ptent = ptep_get(pte); > - struct folio *folio; > + struct folio *folio = NULL; > struct page *page; > > if (pte_none(ptent)) > > >