[gfs2:for-next.mmap-fault 5/12] mm/gup.c:1714:8: error: conflicting types for 'fault_in_safe_writeable'

From: kernel test robot
Date: Tue Aug 03 2021 - 05:59:45 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next.mmap-fault
head: bfd94d74183df4cc99a705b96f2be61a865e5564
commit: f276043444d9cb56239f8525b48febe88dfb0e25 [5/12] iov_iter: Introduce fault_in_iov_iter_writeable
config: xtensa-randconfig-s032-20210803 (attached as .config)
compiler: xtensa-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=f276043444d9cb56239f8525b48febe88dfb0e25
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 f276043444d9cb56239f8525b48febe88dfb0e25
# 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=xtensa SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

>> mm/gup.c:1714:8: error: conflicting types for 'fault_in_safe_writeable'
1714 | size_t fault_in_safe_writeable(const char __user *uaddr, unsigned long len)
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from mm/gup.c:9:
include/linux/pagemap.h:740:8: note: previous declaration of 'fault_in_safe_writeable' was here
740 | size_t fault_in_safe_writeable(const char __user *uaddr, size_t size);
| ^~~~~~~~~~~~~~~~~~~~~~~


vim +/fault_in_safe_writeable +1714 mm/gup.c

1696
1697 /**
1698 * fault_in_safe_writeable - fault in an address range for writing
1699 * @uaddr: start of address range
1700 * @len: length of address range
1701 *
1702 * Faults in an address range using get_user_pages, i.e., without triggering
1703 * hardware page faults. This is primarily useful when we know that some or
1704 * all of the pages in the address range aren't in memory.
1705 *
1706 * Other than fault_in_writeable(), this function is non-destructive.
1707 *
1708 * Note that we don't pin or otherwise hold the pages referenced that we fault
1709 * in. There's no guarantee that they'll stay in memory for any duration of
1710 * time.
1711 *
1712 * Returns the number of bytes faulted in from @uaddr.
1713 */
> 1714 size_t fault_in_safe_writeable(const char __user *uaddr, unsigned long len)
1715 {
1716 unsigned long start = (unsigned long)uaddr;
1717 unsigned long end, nstart, nend;
1718 struct mm_struct *mm = current->mm;
1719 struct vm_area_struct *vma = NULL;
1720 int locked = 0;
1721
1722 /* FIXME: Protect against overflow! */
1723
1724 end = PAGE_ALIGN(start + len);
1725 for (nstart = start & PAGE_MASK; nstart < end; nstart = nend) {
1726 unsigned long nr_pages;
1727 long ret;
1728
1729 if (!locked) {
1730 locked = 1;
1731 mmap_read_lock(mm);
1732 vma = find_vma(mm, nstart);
1733 } else if (nstart >= vma->vm_end)
1734 vma = vma->vm_next;
1735 if (!vma || vma->vm_start >= end)
1736 break;
1737 nend = min(end, vma->vm_end);
1738 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
1739 continue;
1740 if (nstart < vma->vm_start)
1741 nstart = vma->vm_start;
1742 nr_pages = (nend - nstart) / PAGE_SIZE;
1743 ret = __get_user_pages_locked(mm, nstart, nr_pages,
1744 NULL, NULL, &locked,
1745 FOLL_TOUCH | FOLL_WRITE);
1746 if (ret <= 0)
1747 break;
1748 nend = nstart + ret * PAGE_SIZE;
1749 }
1750 if (locked)
1751 mmap_read_unlock(mm);
1752 if (nstart > start)
1753 return min(nstart - start, len);
1754 return 0;
1755 }
1756 EXPORT_SYMBOL(fault_in_safe_writeable);
1757

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

Attachment: .config.gz
Description: application/gzip