CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: David Hildenbrand <[email protected]> TO: [email protected] CC: [email protected] CC: David Hildenbrand <[email protected]> CC: Andrew Morton <[email protected]> CC: Linux Memory Management List <[email protected]> CC: Arnd Bergmann <[email protected]> CC: Michal Hocko <[email protected]> CC: Oscar Salvador <[email protected]> CC: Matthew Wilcox <[email protected]> CC: Andrea Arcangeli <[email protected]>
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 <[email protected]> Reported-by: Dan Carpenter <[email protected]> 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/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
