All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v2 2/5] mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page tables
Date: Tue, 20 Apr 2021 05:52:45 +0800	[thread overview]
Message-ID: <202104200508.9rCLUHPp-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210419135443.12822-3-david@redhat.com>
References: <20210419135443.12822-3-david@redhat.com>
TO: David Hildenbrand <david@redhat.com>
TO: linux-kernel(a)vger.kernel.org
CC: linux-mm(a)kvack.org
CC: David Hildenbrand <david@redhat.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Michal Hocko <mhocko@suse.com>
CC: Oscar Salvador <osalvador@suse.de>
CC: Matthew Wilcox <willy@infradead.org>
CC: Andrea Arcangeli <aarcange@redhat.com>

Hi David,

I love your patch! Perhaps something to improve:

[auto build test WARNING on kselftest/next]
[also build test WARNING on linux/master linus/master v5.12-rc8]
[cannot apply to hnaz-linux-mm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/David-Hildenbrand/mm-madvise-introduce-MADV_POPULATE_-READ-WRITE-to-prefault-page-tables/20210419-220043
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: i386-randconfig-m021-20210419 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
mm/madvise.c:845 madvise_populate() warn: variable dereferenced before check 'vma' (see line 833)

vim +/vma +845 mm/madvise.c

^1da177e4c3f415 Linus Torvalds    2005-04-16  826  
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  827  static long madvise_populate(struct vm_area_struct *vma,
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  828  			     struct vm_area_struct **prev,
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  829  			     unsigned long start, unsigned long end,
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  830  			     int behavior)
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  831  {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  832  	const bool write = behavior == MADV_POPULATE_WRITE;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19 @833  	struct mm_struct *mm = vma->vm_mm;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  834  	unsigned long tmp_end;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  835  	int locked = 1;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  836  	long pages;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  837  
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  838  	*prev = vma;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  839  
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  840  	while (start < end) {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  841  		/*
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  842  		 * We might have temporarily dropped the lock. For example,
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  843  		 * our VMA might have been split.
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  844  		 */
b2cabf1f27bbe5d David Hildenbrand 2021-04-19 @845  		if (!vma || start >= vma->vm_end) {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  846  			vma = find_vma(mm, start);
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  847  			if (!vma || start < vma->vm_start)
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  848  				return -ENOMEM;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  849  		}
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  850  
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  851  		tmp_end = min_t(unsigned long, end, vma->vm_end);
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  852  		/* Populate (prefault) page tables readable/writable. */
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  853  		pages = faultin_vma_page_range(vma, start, tmp_end, write,
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  854  					       &locked);
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  855  		if (!locked) {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  856  			mmap_read_lock(mm);
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  857  			locked = 1;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  858  			*prev = NULL;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  859  			vma = NULL;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  860  		}
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  861  		if (pages < 0) {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  862  			switch (pages) {
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  863  			case -EINTR:
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  864  				return -EINTR;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  865  			case -EFAULT: /* Incompatible mappings / permissions. */
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  866  				return -EINVAL;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  867  			case -EHWPOISON:
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  868  				return -EHWPOISON;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  869  			default:
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  870  				pr_warn_once("%s: unhandled return value: %ld\n",
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  871  					     __func__, pages);
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  872  				fallthrough;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  873  			case -ENOMEM:
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  874  				return -ENOMEM;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  875  			}
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  876  		}
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  877  		start += pages * PAGE_SIZE;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  878  	}
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  879  	return 0;
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  880  }
b2cabf1f27bbe5d David Hildenbrand 2021-04-19  881  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31489 bytes --]

             reply	other threads:[~2021-04-19 21:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 21:52 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-19 13:54 [PATCH v2 0/5] mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault page tables David Hildenbrand
     [not found] ` <20210419135443.12822-1-david-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2021-04-19 13:54   ` [PATCH v2 2/5] " David Hildenbrand
2021-04-19 13:54     ` David Hildenbrand

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=202104200508.9rCLUHPp-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@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.