mm/mmap.c:1617:5: warning: passing argument 4 of 'hugetlb_file_setup' makes pointer from integer without a cast

From: kernel test robot
Date: Mon Nov 01 2021 - 10:41:24 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20211101-194552/zhangyiru/mm-hugetlb-remove-mlock-ulimit-for-SHM_HUGETLB/20211009-094538
head: 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
commit: 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd mm,hugetlb: remove mlock ulimit for SHM_HUGETLB
date: 3 hours ago
config: i386-tinyconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20211101-194552/zhangyiru/mm-hugetlb-remove-mlock-ulimit-for-SHM_HUGETLB/20211009-094538
git checkout 00d28e7a2b1786c1ab3b63cc3abb4aca5c02fdfd
# save the attached .config to linux build tree
make W=1 ARCH=i386

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

All warnings (new ones prefixed by >>):

mm/mmap.c: In function 'ksys_mmap_pgoff':
>> mm/mmap.c:1617:5: warning: passing argument 4 of 'hugetlb_file_setup' makes pointer from integer without a cast [-Wint-conversion]
1617 | HUGETLB_ANONHUGE_INODE,
| ^~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from mm/mmap.c:28:
include/linux/hugetlb.h:491:20: note: expected 'struct ucounts **' but argument is of type 'int'
491 | struct ucounts **ucounts, int creat_flags,
| ~~~~~~~~~~~~~~~~~^~~~~~~
mm/mmap.c:1615:10: error: too few arguments to function 'hugetlb_file_setup'
1615 | file = hugetlb_file_setup(HUGETLB_ANON_FILE, len,
| ^~~~~~~~~~~~~~~~~~
In file included from mm/mmap.c:28:
include/linux/hugetlb.h:490:1: note: declared here
490 | hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
| ^~~~~~~~~~~~~~~~~~


vim +/hugetlb_file_setup +1617 mm/mmap.c

1582
1583 unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
1584 unsigned long prot, unsigned long flags,
1585 unsigned long fd, unsigned long pgoff)
1586 {
1587 struct file *file = NULL;
1588 unsigned long retval;
1589
1590 if (!(flags & MAP_ANONYMOUS)) {
1591 audit_mmap_fd(fd, flags);
1592 file = fget(fd);
1593 if (!file)
1594 return -EBADF;
1595 if (is_file_hugepages(file)) {
1596 len = ALIGN(len, huge_page_size(hstate_file(file)));
1597 } else if (unlikely(flags & MAP_HUGETLB)) {
1598 retval = -EINVAL;
1599 goto out_fput;
1600 }
1601 } else if (flags & MAP_HUGETLB) {
1602 struct hstate *hs;
1603
1604 hs = hstate_sizelog((flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK);
1605 if (!hs)
1606 return -EINVAL;
1607
1608 len = ALIGN(len, huge_page_size(hs));
1609 /*
1610 * VM_NORESERVE is used because the reservations will be
1611 * taken when vm_ops->mmap() is called
1612 * A dummy user value is used because we are not locking
1613 * memory so no accounting is necessary
1614 */
1615 file = hugetlb_file_setup(HUGETLB_ANON_FILE, len,
1616 VM_NORESERVE,
> 1617 HUGETLB_ANONHUGE_INODE,
1618 (flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK);
1619 if (IS_ERR(file))
1620 return PTR_ERR(file);
1621 }
1622
1623 retval = vm_mmap_pgoff(file, addr, len, prot, flags, pgoff);
1624 out_fput:
1625 if (file)
1626 fput(file);
1627 return retval;
1628 }
1629

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

Attachment: .config.gz
Description: application/gzip