All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [intel-lts:5.10/android-civ 21771/23680] fs/userfaultfd.c:1875:39: warning: passing argument 2 of 'validate_range' makes integer from pointer without a cast
Date: Sun, 05 Dec 2021 05:06:11 +0800	[thread overview]
Message-ID: <202112050455.AnhWSX7z-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7081 bytes --]

tree:   https://github.com/intel/linux-intel-lts.git 5.10/android-civ
head:   0e493748b235bf61d817dabdad2832ac4e932217
commit: 532f15c329f05070e3d5e8010b555dac1dac8f4b [21771/23680] Merge branch 'v5.10/yocto/20210902' into android_0902
config: arc-randconfig-r043-20211203 (https://download.01.org/0day-ci/archive/20211205/202112050455.AnhWSX7z-lkp(a)intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel/linux-intel-lts/commit/532f15c329f05070e3d5e8010b555dac1dac8f4b
        git remote add intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-lts 5.10/android-civ
        git checkout 532f15c329f05070e3d5e8010b555dac1dac8f4b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

   fs/userfaultfd.c: In function 'userfaultfd_continue':
>> fs/userfaultfd.c:1875:39: warning: passing argument 2 of 'validate_range' makes integer from pointer without a cast [-Wint-conversion]
    1875 |         ret = validate_range(ctx->mm, &uffdio_continue.range.start,
         |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                       |
         |                                       __u64 * {aka long long unsigned int *}
   fs/userfaultfd.c:1245:49: note: expected '__u64' {aka 'long long unsigned int'} but argument is of type '__u64 *' {aka 'long long unsigned int *'}
    1245 |                                           __u64 start, __u64 len)
         |                                           ~~~~~~^~~~~


vim +/validate_range +1875 fs/userfaultfd.c

63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1855  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1856  static int userfaultfd_continue(struct userfaultfd_ctx *ctx, unsigned long arg)
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1857  {
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1858  	__s64 ret;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1859  	struct uffdio_continue uffdio_continue;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1860  	struct uffdio_continue __user *user_uffdio_continue;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1861  	struct userfaultfd_wake_range range;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1862  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1863  	user_uffdio_continue = (struct uffdio_continue __user *)arg;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1864  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1865  	ret = -EAGAIN;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1866  	if (READ_ONCE(ctx->mmap_changing))
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1867  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1868  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1869  	ret = -EFAULT;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1870  	if (copy_from_user(&uffdio_continue, user_uffdio_continue,
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1871  			   /* don't copy the output fields */
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1872  			   sizeof(uffdio_continue) - (sizeof(__s64))))
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1873  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1874  
4a5cf92412ab1a Axel Rasmussen   2021-03-18 @1875  	ret = validate_range(ctx->mm, &uffdio_continue.range.start,
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1876  			     uffdio_continue.range.len);
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1877  	if (ret)
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1878  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1879  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1880  	ret = -EINVAL;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1881  	/* double check for wraparound just in case. */
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1882  	if (uffdio_continue.range.start + uffdio_continue.range.len <=
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1883  	    uffdio_continue.range.start) {
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1884  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1885  	}
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1886  	if (uffdio_continue.mode & ~UFFDIO_CONTINUE_MODE_DONTWAKE)
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1887  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1888  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1889  	if (mmget_not_zero(ctx->mm)) {
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1890  		ret = mcopy_continue(ctx->mm, uffdio_continue.range.start,
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1891  				     uffdio_continue.range.len,
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1892  				     &ctx->mmap_changing);
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1893  		mmput(ctx->mm);
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1894  	} else {
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1895  		return -ESRCH;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1896  	}
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1897  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1898  	if (unlikely(put_user(ret, &user_uffdio_continue->mapped)))
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1899  		return -EFAULT;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1900  	if (ret < 0)
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1901  		goto out;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1902  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1903  	/* len == 0 would wake all */
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1904  	BUG_ON(!ret);
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1905  	range.len = ret;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1906  	if (!(uffdio_continue.mode & UFFDIO_CONTINUE_MODE_DONTWAKE)) {
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1907  		range.start = uffdio_continue.range.start;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1908  		wake_userfault(ctx, &range);
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1909  	}
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1910  	ret = range.len == uffdio_continue.range.len ? 0 : -EAGAIN;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1911  
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1912  out:
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1913  	return ret;
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1914  }
4a5cf92412ab1a Axel Rasmussen   2021-03-18  1915  

:::::: The code@line 1875 was first introduced by commit
:::::: 4a5cf92412ab1a3fdf6ad24d901f5e14fd56d4fa BACKPORT: FROMGIT: userfaultfd: add UFFDIO_CONTINUE ioctl

:::::: TO: Axel Rasmussen <axelrasmussen@google.com>
:::::: CC: Todd Kjos <tkjos@google.com>

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

                 reply	other threads:[~2021-12-04 21:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202112050455.AnhWSX7z-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.