[gfs2:for-next.mmap-fault 3/12] mm/gup.c:1685:23: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Tue Aug 03 2021 - 08:02:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next.mmap-fault
head: bfd94d74183df4cc99a705b96f2be61a865e5564
commit: 88a42059bb37be7ced7c0f4a62de07195bd7074e [3/12] Turn fault_in_pages_{readable,writeable} into fault_in_{readable,writeable}
config: s390-randconfig-s031-20210803 (attached as .config)
compiler: s390-linux-gcc (GCC) 10.3.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.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/commit/?id=88a42059bb37be7ced7c0f4a62de07195bd7074e
git remote add gfs2 https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git
git fetch --no-tags gfs2 for-next.mmap-fault
git checkout 88a42059bb37be7ced7c0f4a62de07195bd7074e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> mm/gup.c:1685:23: sparse: sparse: Using plain integer as NULL pointer
mm/gup.c:1711:23: sparse: sparse: Using plain integer as NULL pointer

vim +1685 mm/gup.c

1671
1672 size_t fault_in_writeable(char __user *uaddr, size_t size)
1673 {
1674 char __user *start = uaddr, *end;
1675
1676 if (unlikely(size == 0))
1677 return 0;
1678 if ((unsigned long)uaddr & ~PAGE_MASK) {
1679 if (unlikely(__put_user(0, uaddr) != 0))
1680 return 0;
1681 uaddr = (char __user *)((unsigned long)uaddr | ~PAGE_MASK) + 1;
1682 }
1683 end = (char __user *)PAGE_ALIGN((unsigned long)uaddr + size);
1684 if (unlikely(end < uaddr))
> 1685 end = 0;
1686 while (uaddr != end) {
1687 if (unlikely(__put_user(0, uaddr) != 0))
1688 goto out;
1689 uaddr += PAGE_SIZE;
1690 }
1691
1692 out:
1693 return min_t(size_t, uaddr - start, size);
1694 }
1695 EXPORT_SYMBOL(fault_in_writeable);
1696

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

Attachment: .config.gz
Description: application/gzip