[linux-next:master 10184/10591] mm/gup.c:3446 pin_user_pages_fd() warn: unsigned 'start' is never less than zero.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2a860505b617cf8fda4ebff6cf05d3f774145440
commit: ad999eeb01ea4bd5c667d80e5c2cea4ef9c47e3e [10184/10591] mm/gup: introduce pin_user_pages_fd() for pinning shmem/hugetlbfs file pages
config: i386-randconfig-141-20231008 (https://download.01.org/0day-ci/archive/20231010/202310100409.LrBAYpmk-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231010/202310100409.LrBAYpmk-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310100409.LrBAYpmk-lkp@xxxxxxxxx/

smatch warnings:
mm/gup.c:3446 pin_user_pages_fd() warn: unsigned 'start' is never less than zero.

vim +/start +3446 mm/gup.c

  3413	
  3414	/**
  3415	 * pin_user_pages_fd() - pin user pages associated with a file
  3416	 * @fd:         the fd whose pages are to be pinned
  3417	 * @start:      starting file offset
  3418	 * @nr_pages:   number of pages from start to pin
  3419	 * @gup_flags:  flags modifying pin behaviour
  3420	 * @pages:      array that receives pointers to the pages pinned.
  3421	 *              Should be at least nr_pages long.
  3422	 *
  3423	 * Attempt to pin (and migrate) pages associated with a file belonging to
  3424	 * either shmem or hugetlbfs. An error is returned if pages associated with
  3425	 * hugetlbfs files are not present in the page cache. However, shmem pages
  3426	 * are swapped in or allocated if they are not present in the page cache.
  3427	 *
  3428	 * Returns number of pages pinned. This would be equal to the number of
  3429	 * pages requested.
  3430	 * If nr_pages is 0 or negative, returns 0. If no pages were pinned, returns
  3431	 * -errno.
  3432	 */
  3433	long pin_user_pages_fd(int fd, pgoff_t start, unsigned long nr_pages,
  3434			       unsigned int gup_flags, struct page **pages)
  3435	{
  3436		struct page *page;
  3437		struct file *filep;
  3438		unsigned int flags, i;
  3439		long ret;
  3440	
  3441		if (nr_pages <= 0)
  3442			return 0;
  3443		if (!is_valid_gup_args(pages, NULL, &gup_flags, FOLL_PIN))
  3444			return 0;
  3445	
> 3446		if (start < 0)

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux