[ammarfaizi2-block:google/android/kernel/common/android-gs-raviole-5.10-android12-qpr1-d 1711/8858] arch/arm64/mm/fault.c:492:31: sparse: sparse: incorrect type in return expression (different base types)

From: kernel test robot
Date: Mon Feb 07 2022 - 20:19:26 EST


tree: https://github.com/ammarfaizi2/linux-block google/android/kernel/common/android-gs-raviole-5.10-android12-qpr1-d
head: 9771767708df4fcf51cd1642e041c804a86e740c
commit: 2fd69fa6bcab984b56ccfd4860b10f11f1966bed [1711/8858] FROMLIST: arm64/mm: add speculative page fault
config: arm64-randconfig-s031-20220207 (https://download.01.org/0day-ci/archive/20220208/202202080945.Pweq3bsl-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/ammarfaizi2/linux-block/commit/2fd69fa6bcab984b56ccfd4860b10f11f1966bed
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block google/android/kernel/common/android-gs-raviole-5.10-android12-qpr1-d
git checkout 2fd69fa6bcab984b56ccfd4860b10f11f1966bed
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/mm/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> arch/arm64/mm/fault.c:492:31: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted vm_fault_t @@
arch/arm64/mm/fault.c:492:31: sparse: expected int
arch/arm64/mm/fault.c:492:31: sparse: got restricted vm_fault_t
arch/arm64/mm/fault.c:561:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted vm_fault_t [usertype] fault @@ got int @@
arch/arm64/mm/fault.c:561:15: sparse: expected restricted vm_fault_t [usertype] fault
arch/arm64/mm/fault.c:561:15: sparse: got int
arch/arm64/mm/fault.c:591:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted vm_fault_t [usertype] fault @@ got int @@
arch/arm64/mm/fault.c:591:15: sparse: expected restricted vm_fault_t [usertype] fault
arch/arm64/mm/fault.c:591:15: sparse: got int
arch/arm64/mm/fault.c:620:13: sparse: sparse: restricted vm_fault_t degrades to integer
arch/arm64/mm/fault.c:620:13: sparse: sparse: restricted vm_fault_t degrades to integer
arch/arm64/mm/fault.c:665:39: sparse: sparse: restricted vm_fault_t degrades to integer

vim +492 arch/arm64/mm/fault.c

1d18c47c735e8a Catalin Marinas 2012-03-05 471
1d18c47c735e8a Catalin Marinas 2012-03-05 472 if (unlikely(!vma))
4745224b45097d Anshuman Khandual 2019-06-07 473 return VM_FAULT_BADMAP;
1d18c47c735e8a Catalin Marinas 2012-03-05 474
1d18c47c735e8a Catalin Marinas 2012-03-05 475 /*
1d18c47c735e8a Catalin Marinas 2012-03-05 476 * Ok, we have a good vm_area for this memory access, so we can handle
1d18c47c735e8a Catalin Marinas 2012-03-05 477 * it.
1d18c47c735e8a Catalin Marinas 2012-03-05 478 */
4745224b45097d Anshuman Khandual 2019-06-07 479 if (unlikely(vma->vm_start > addr)) {
4745224b45097d Anshuman Khandual 2019-06-07 480 if (!(vma->vm_flags & VM_GROWSDOWN))
4745224b45097d Anshuman Khandual 2019-06-07 481 return VM_FAULT_BADMAP;
4745224b45097d Anshuman Khandual 2019-06-07 482 if (expand_stack(vma, addr))
4745224b45097d Anshuman Khandual 2019-06-07 483 return VM_FAULT_BADMAP;
4745224b45097d Anshuman Khandual 2019-06-07 484 }
4745224b45097d Anshuman Khandual 2019-06-07 485
db6f41063cbdb5 Will Deacon 2013-07-19 486 /*
db6f41063cbdb5 Will Deacon 2013-07-19 487 * Check that the permissions on the VMA allow for the fault which
cab15ce604e550 Catalin Marinas 2016-08-11 488 * occurred.
db6f41063cbdb5 Will Deacon 2013-07-19 489 */
4745224b45097d Anshuman Khandual 2019-06-07 490 if (!(vma->vm_flags & vm_flags))
4745224b45097d Anshuman Khandual 2019-06-07 491 return VM_FAULT_BADACCESS;
6a1bb025d28e10 Peter Xu 2020-08-11 @492 return handle_mm_fault(vma, addr & PAGE_MASK, mm_flags, regs);
1d18c47c735e8a Catalin Marinas 2012-03-05 493 }
1d18c47c735e8a Catalin Marinas 2012-03-05 494

:::::: The code at line 492 was first introduced by commit
:::::: 6a1bb025d28e1026fead73b7b33e2dfccba3f4d2 mm/arm64: use general page fault accounting

:::::: TO: Peter Xu <peterx@xxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx