[akpm-mm:mm-unstable 174/199] mm/memory.c:5094:25: warning: variable 'pte' is uninitialized when used here

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head:   2f423131bebaa5a4f4b8cf460d96245e93a40905
commit: 0f47c75aeb7aae02c433e322ebbd4d6d757418d5 [174/199] mm: support multi-size THP numa balancing
config: x86_64-randconfig-123-20240327 (https://download.01.org/0day-ci/archive/20240328/202403280834.zWjRlaM9-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240328/202403280834.zWjRlaM9-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/202403280834.zWjRlaM9-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> mm/memory.c:5094:25: warning: variable 'pte' is uninitialized when used here [-Wuninitialized]
    5094 |                         writable = pte_write(pte);
         |                                              ^~~
   mm/memory.c:5083:3: note: variable 'pte' is declared here
    5083 |                 pte_t pte, old_pte;
         |                 ^
   1 warning generated.


vim +/pte +5094 mm/memory.c

  5070	
  5071	static void numa_rebuild_large_mapping(struct vm_fault *vmf, struct vm_area_struct *vma,
  5072					       struct folio *folio, pte_t fault_pte, bool ignore_writable)
  5073	{
  5074		int nr = pte_pfn(fault_pte) - folio_pfn(folio);
  5075		unsigned long start = max(vmf->address - nr * PAGE_SIZE, vma->vm_start);
  5076		unsigned long end = min(start + folio_nr_pages(folio) * PAGE_SIZE, vma->vm_end);
  5077		pte_t *start_ptep = vmf->pte - (vmf->address - start) / PAGE_SIZE;
  5078		bool pte_write_upgrade = vma_wants_manual_pte_write_upgrade(vma);
  5079		unsigned long addr;
  5080	
  5081		/* Restore all PTEs' mapping of the large folio */
  5082		for (addr = start; addr != end; start_ptep++, addr += PAGE_SIZE) {
  5083			pte_t pte, old_pte;
  5084			pte_t ptent = ptep_get(start_ptep);
  5085			bool writable = false;
  5086	
  5087			if (!pte_present(ptent) || !pte_protnone(ptent))
  5088				continue;
  5089	
  5090			if (vm_normal_folio(vma, addr, ptent) != folio)
  5091				continue;
  5092	
  5093			if (!ignore_writable) {
> 5094				writable = pte_write(pte);
  5095				if (!writable && pte_write_upgrade &&
  5096				    can_change_pte_writable(vma, addr, pte))
  5097					writable = true;
  5098			}
  5099	
  5100			old_pte = ptep_modify_prot_start(vma, addr, start_ptep);
  5101			pte = pte_modify(old_pte, vma->vm_page_prot);
  5102			pte = pte_mkyoung(pte);
  5103			if (writable)
  5104				pte = pte_mkwrite(pte, vma);
  5105			ptep_modify_prot_commit(vma, addr, start_ptep, old_pte, pte);
  5106			update_mmu_cache_range(vmf, vma, addr, start_ptep, 1);
  5107		}
  5108	}
  5109	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux