[linux-next:master 11850/11910] mm/memory.c:3965:21: sparse: warning: incorrect type in assignment (different base types)

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   c63e9e91a254a529716367234fd8093bb7b061ca
commit: 642e0b7a20093b29adaf0961b8a08983225c739d [11850/11910] mm: create the new vm_fault_t type
reproduce:
        # apt-get install sparse
        git checkout 642e0b7a20093b29adaf0961b8a08983225c739d
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

All warnings (new ones prefixed by >>):

   mm/memory.c:127:15: sparse: warning: symbol 'zero_pfn' was not declared. Should it be static?
>> mm/memory.c:3965:21: sparse: warning: incorrect type in assignment (different base types)
   mm/memory.c:3965:21: sparse:    expected restricted vm_fault_t [usertype] ret
   mm/memory.c:3965:21: sparse:    got int
   mm/memory.c:833:17: sparse: warning: context imbalance in 'copy_pte_range' - different lock contexts for basic block
   mm/memory.c:1436:16: sparse: warning: context imbalance in '__get_locked_pte' - different lock contexts for basic block
   mm/memory.c:1745:17: sparse: warning: context imbalance in 'remap_pte_range' - different lock contexts for basic block
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'apply_to_pte_range' - unexpected unlock
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'wp_pfn_shared' - unexpected unlock
   mm/memory.c:2489:19: sparse: warning: context imbalance in 'do_wp_page' - different lock contexts for basic block
   mm/memory.c:3071:19: sparse: warning: context imbalance in 'pte_alloc_one_map' - different lock contexts for basic block
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'finish_fault' - unexpected unlock
   mm/memory.c:3423:9: sparse: warning: context imbalance in 'do_fault_around' - unexpected unlock
   mm/memory.c:4073:12: sparse: warning: context imbalance in '__follow_pte_pmd' - different lock contexts for basic block
   mm/memory.c:4150:5: sparse: warning: context imbalance in 'follow_pte_pmd' - different lock contexts for basic block

sparse warnings: (new ones prefixed by >>)

   mm/memory.c:3965:21: sparse: warning: incorrect type in assignment (different base types)
>> mm/memory.c:3965:21: sparse:    expected restricted vm_fault_t [usertype] ret
>> mm/memory.c:3965:21: sparse:    got int
   mm/memory.c:833:17: sparse: warning: context imbalance in 'copy_pte_range' - different lock contexts for basic block
   mm/memory.c:1436:16: sparse: warning: context imbalance in '__get_locked_pte' - different lock contexts for basic block
   mm/memory.c:1745:17: sparse: warning: context imbalance in 'remap_pte_range' - different lock contexts for basic block
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'apply_to_pte_range' - unexpected unlock
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'wp_pfn_shared' - unexpected unlock
   mm/memory.c:2489:19: sparse: warning: context imbalance in 'do_wp_page' - different lock contexts for basic block
   mm/memory.c:3071:19: sparse: warning: context imbalance in 'pte_alloc_one_map' - different lock contexts for basic block
   include/linux/spinlock.h:369:9: sparse: warning: context imbalance in 'finish_fault' - unexpected unlock
   mm/memory.c:3423:9: sparse: warning: context imbalance in 'do_fault_around' - unexpected unlock
   mm/memory.c:4073:12: sparse: warning: context imbalance in '__follow_pte_pmd' - different lock contexts for basic block
   mm/memory.c:4150:5: sparse: warning: context imbalance in 'follow_pte_pmd' - different lock contexts for basic block

vim +3965 mm/memory.c

^1da177e Linus Torvalds     2005-04-16  3932  
9a95f3cf Paul Cassella      2014-08-06  3933  /*
9a95f3cf Paul Cassella      2014-08-06  3934   * By the time we get here, we already hold the mm semaphore
9a95f3cf Paul Cassella      2014-08-06  3935   *
9a95f3cf Paul Cassella      2014-08-06  3936   * The mmap_sem may have been released depending on flags and our
9a95f3cf Paul Cassella      2014-08-06  3937   * return value.  See filemap_fault() and __lock_page_or_retry().
9a95f3cf Paul Cassella      2014-08-06  3938   */
2b740303 Souptick Joarder   2018-08-23  3939  vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
dcddffd4 Kirill A. Shutemov 2016-07-26  3940  		unsigned int flags)
519e5247 Johannes Weiner    2013-09-12  3941  {
2b740303 Souptick Joarder   2018-08-23  3942  	vm_fault_t ret;
519e5247 Johannes Weiner    2013-09-12  3943  
519e5247 Johannes Weiner    2013-09-12  3944  	__set_current_state(TASK_RUNNING);
519e5247 Johannes Weiner    2013-09-12  3945  
519e5247 Johannes Weiner    2013-09-12  3946  	count_vm_event(PGFAULT);
2262185c Roman Gushchin     2017-07-06  3947  	count_memcg_event_mm(vma->vm_mm, PGFAULT);
519e5247 Johannes Weiner    2013-09-12  3948  
519e5247 Johannes Weiner    2013-09-12  3949  	/* do counter updates before entering really critical section. */
519e5247 Johannes Weiner    2013-09-12  3950  	check_sync_rss_stat(current);
519e5247 Johannes Weiner    2013-09-12  3951  
de0c799b Laurent Dufour     2017-09-08  3952  	if (!arch_vma_access_permitted(vma, flags & FAULT_FLAG_WRITE,
de0c799b Laurent Dufour     2017-09-08  3953  					    flags & FAULT_FLAG_INSTRUCTION,
de0c799b Laurent Dufour     2017-09-08  3954  					    flags & FAULT_FLAG_REMOTE))
de0c799b Laurent Dufour     2017-09-08  3955  		return VM_FAULT_SIGSEGV;
de0c799b Laurent Dufour     2017-09-08  3956  
519e5247 Johannes Weiner    2013-09-12  3957  	/*
519e5247 Johannes Weiner    2013-09-12  3958  	 * Enable the memcg OOM handling for faults triggered in user
519e5247 Johannes Weiner    2013-09-12  3959  	 * space.  Kernel faults are handled more gracefully.
519e5247 Johannes Weiner    2013-09-12  3960  	 */
519e5247 Johannes Weiner    2013-09-12  3961  	if (flags & FAULT_FLAG_USER)
29ef680a Michal Hocko       2018-08-17  3962  		mem_cgroup_enter_user_fault();
519e5247 Johannes Weiner    2013-09-12  3963  
bae473a4 Kirill A. Shutemov 2016-07-26  3964  	if (unlikely(is_vm_hugetlb_page(vma)))
bae473a4 Kirill A. Shutemov 2016-07-26 @3965  		ret = hugetlb_fault(vma->vm_mm, vma, address, flags);
bae473a4 Kirill A. Shutemov 2016-07-26  3966  	else
dcddffd4 Kirill A. Shutemov 2016-07-26  3967  		ret = __handle_mm_fault(vma, address, flags);
519e5247 Johannes Weiner    2013-09-12  3968  
49426420 Johannes Weiner    2013-10-16  3969  	if (flags & FAULT_FLAG_USER) {
29ef680a Michal Hocko       2018-08-17  3970  		mem_cgroup_exit_user_fault();
49426420 Johannes Weiner    2013-10-16  3971  		/*
49426420 Johannes Weiner    2013-10-16  3972  		 * The task may have entered a memcg OOM situation but
49426420 Johannes Weiner    2013-10-16  3973  		 * if the allocation error was handled gracefully (no
49426420 Johannes Weiner    2013-10-16  3974  		 * VM_FAULT_OOM), there is no need to kill anything.
49426420 Johannes Weiner    2013-10-16  3975  		 * Just clean up the OOM state peacefully.
49426420 Johannes Weiner    2013-10-16  3976  		 */
49426420 Johannes Weiner    2013-10-16  3977  		if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM))
49426420 Johannes Weiner    2013-10-16  3978  			mem_cgroup_oom_synchronize(false);
49426420 Johannes Weiner    2013-10-16  3979  	}
3812c8c8 Johannes Weiner    2013-09-12  3980  
519e5247 Johannes Weiner    2013-09-12  3981  	return ret;
519e5247 Johannes Weiner    2013-09-12  3982  }
e1d6d01a Jesse Barnes       2014-12-12  3983  EXPORT_SYMBOL_GPL(handle_mm_fault);
519e5247 Johannes Weiner    2013-09-12  3984  

:::::: The code at line 3965 was first introduced by commit
:::::: bae473a423f65e480db83c85b5e92254f6dfcb28 mm: introduce fault_env

:::::: TO: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[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