arch/arm/mm/fault.c:210:24: sparse: sparse: incorrect type in return expression (different base types)

From: kernel test robot
Date: Sun Nov 14 2021 - 23:57:22 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab774587903771821b59471cc723bba6d893942
commit: caed89dab0ca0e73d7e016c04e1f5957650f4ec3 ARM: 9128/1: mm: Refactor the __do_page_fault()
date: 4 weeks ago
config: arm-randconfig-s031-20211115 (attached as .config)
compiler: arm-linux-gnueabi-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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=caed89dab0ca0e73d7e016c04e1f5957650f4ec3
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout caed89dab0ca0e73d7e016c04e1f5957650f4ec3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash arch/arm/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/arm/mm/fault.c:210:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted vm_fault_t @@ got int @@
arch/arm/mm/fault.c:210:24: sparse: expected restricted vm_fault_t
arch/arm/mm/fault.c:210:24: sparse: got int
arch/arm/mm/fault.c:214:32: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted vm_fault_t @@ got int @@
arch/arm/mm/fault.c:214:32: sparse: expected restricted vm_fault_t
arch/arm/mm/fault.c:214:32: sparse: got int
arch/arm/mm/fault.c:216:32: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted vm_fault_t @@ got int @@
arch/arm/mm/fault.c:216:32: sparse: expected restricted vm_fault_t
arch/arm/mm/fault.c:216:32: sparse: got int
arch/arm/mm/fault.c:218:32: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted vm_fault_t @@ got int @@
arch/arm/mm/fault.c:218:32: sparse: expected restricted vm_fault_t
arch/arm/mm/fault.c:218:32: sparse: got int
arch/arm/mm/fault.c:226:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted vm_fault_t @@ got int @@
arch/arm/mm/fault.c:226:24: sparse: expected restricted vm_fault_t
arch/arm/mm/fault.c:226:24: sparse: got int
arch/arm/mm/fault.c:312:13: sparse: sparse: restricted vm_fault_t degrades to integer
arch/arm/mm/fault.c:312:13: sparse: sparse: restricted vm_fault_t degrades to integer
arch/arm/mm/fault.c:345:24: sparse: sparse: restricted vm_fault_t degrades to integer
arch/arm/mm/fault.c:510:1: sparse: sparse: symbol 'do_DataAbort' was not declared. Should it be static?
arch/arm/mm/fault.c:540:1: sparse: sparse: symbol 'do_PrefetchAbort' was not declared. Should it be static?

vim +210 arch/arm/mm/fault.c

202
203 static vm_fault_t __kprobes
204 __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
205 unsigned int flags, struct task_struct *tsk,
206 struct pt_regs *regs)
207 {
208 struct vm_area_struct *vma = find_vma(mm, addr);
209 if (unlikely(!vma))
> 210 return VM_FAULT_BADMAP;
211
212 if (unlikely(vma->vm_start > addr)) {
213 if (!(vma->vm_flags & VM_GROWSDOWN))
214 return VM_FAULT_BADMAP;
215 if (addr < FIRST_USER_ADDRESS)
216 return VM_FAULT_BADMAP;
217 if (expand_stack(vma, addr))
218 return VM_FAULT_BADMAP;
219 }
220
221 /*
222 * Ok, we have a good vm_area for this
223 * memory access, so we can handle it.
224 */
225 if (access_error(fsr, vma))
226 return VM_FAULT_BADACCESS;
227
228 return handle_mm_fault(vma, addr & PAGE_MASK, flags, regs);
229 }
230

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

Attachment: .config.gz
Description: application/gzip