powerpc: Hugetlb for BookE

Dan Carpenter dan.carpenter at oracle.com
Fri Nov 8 00:12:47 EST 2013


Hello Becky Bruce,

This is a semi-automatic email about new static checker warnings.

The patch 41151e77a4d9: "powerpc: Hugetlb for BookE" from Jun 28, 
2011, leads to the following Smatch complaint:

arch/powerpc/mm/hugetlbpage-book3e.c:120 flush_hugetlb_page()
	 warn: variable dereferenced before check 'vma' (see line 117)

arch/powerpc/mm/hugetlbpage-book3e.c
   116	{
   117		struct hstate *hstate = hstate_file(vma->vm_file);
                                                    ^^^^^^^^^^^^
Dereference.

   118		unsigned long tsize = huge_page_shift(hstate) - 10;
   119	
   120		__flush_tlb_page(vma ? vma->vm_mm : NULL, vmaddr, tsize, 0);
                                 ^^^
Check is too late.

   121	
   122	}

Also in the caller:

arch/powerpc/mm/tlb_nohash.c
   305  void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
   306  {
   307  #ifdef CONFIG_HUGETLB_PAGE
   308          if (is_vm_hugetlb_page(vma))
                    ^^^^^^^^^^^^^^^^^^^^^^
Dereferenced inside is_vm_hugetlb_page().

   309                  flush_hugetlb_page(vma, vmaddr);
   310  #endif
   311  
   312          __flush_tlb_page(vma ? vma->vm_mm : NULL, vmaddr,
   313                           mmu_get_tsize(mmu_virtual_psize), 0);
   314  }

regards,
dan carpenter


More information about the Linuxppc-dev mailing list