Hi Alexander,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/x86/mm]
[also build test WARNING on linus/master v5.16-rc5]
[cannot apply to tip/x86/core hnaz-mm/master next-20211214]
[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/Alexander-Potapenko/Add-KernelMe...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
35fa745286ac44ee26ed100c2bd2553368ad193b
config: x86_64-randconfig-s021-20211214
(
https://download.01.org/0day-ci/archive/20211215/202112151609.GqpX1iLK-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
#
https://github.com/0day-ci/linux/commit/a9bc41d306e2e13721a1569145cbfe732...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20211215-003033
git checkout a9bc41d306e2e13721a1569145cbfe7323a60aca
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir
ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> mm/memory.c:5144:33: sparse: sparse: incorrect type in argument 1
(different address spaces) @@ expected void [noderef] __user *to @@ got void * @@
mm/memory.c:5144:33: sparse: expected void [noderef] __user *to
mm/memory.c:5144:33: sparse: got void *
> mm/memory.c:5148:33: sparse: sparse: incorrect type in argument 2
(different address spaces) @@ expected void const [noderef] __user *from @@ got
void * @@
mm/memory.c:5148:33: sparse: expected void const [noderef] __user
*from
mm/memory.c:5148:33: sparse: got void *
> mm/memory.c:5148:33: sparse: sparse: incorrect type in argument 2
(different address spaces) @@ expected void const [noderef] __user *from @@ got
void * @@
mm/memory.c:5148:33: sparse: expected void const [noderef] __user
*from
mm/memory.c:5148:33: sparse: got void *
mm/memory.c:332:9: sparse: sparse: incompatible types in conditional expression
(different base types):
mm/memory.c:332:9: sparse: void
mm/memory.c:332:9: sparse: int
vim +5144 mm/memory.c
28b2ee20c7cba81 Rik van Riel 2008-07-23 5096
0ec76a110f432e9 David Howells 2006-09-27 5097 /*
d3f5ffcacd15287 John Hubbard 2020-12-14 5098 * Access another process'
address space as given in mm.
0ec76a110f432e9 David Howells 2006-09-27 5099 */
d3f5ffcacd15287 John Hubbard 2020-12-14 5100 int __access_remote_vm(struct
mm_struct *mm, unsigned long addr, void *buf,
d3f5ffcacd15287 John Hubbard 2020-12-14 5101 int len, unsigned int
gup_flags)
0ec76a110f432e9 David Howells 2006-09-27 5102 {
0ec76a110f432e9 David Howells 2006-09-27 5103 struct vm_area_struct *vma;
0ec76a110f432e9 David Howells 2006-09-27 5104 void *old_buf = buf;
442486ec1096781 Lorenzo Stoakes 2016-10-13 5105 int write = gup_flags &
FOLL_WRITE;
0ec76a110f432e9 David Howells 2006-09-27 5106
d8ed45c5dcd455f Michel Lespinasse 2020-06-08 5107 if (mmap_read_lock_killable(mm))
1e426fe28261b03 Konstantin Khlebnikov 2019-07-11 5108 return 0;
1e426fe28261b03 Konstantin Khlebnikov 2019-07-11 5109
183ff22bb6bd818 Simon Arlott 2007-10-20 5110 /* ignore errors, just check how
much was successfully transferred */
0ec76a110f432e9 David Howells 2006-09-27 5111 while (len) {
0ec76a110f432e9 David Howells 2006-09-27 5112 int bytes, ret, offset;
0ec76a110f432e9 David Howells 2006-09-27 5113 void *maddr;
28b2ee20c7cba81 Rik van Riel 2008-07-23 5114 struct page *page = NULL;
0ec76a110f432e9 David Howells 2006-09-27 5115
64019a2e467a288 Peter Xu 2020-08-11 5116 ret = get_user_pages_remote(mm,
addr, 1,
5b56d49fc31dbb0 Lorenzo Stoakes 2016-12-14 5117 gup_flags, &page,
&vma, NULL);
28b2ee20c7cba81 Rik van Riel 2008-07-23 5118 if (ret <= 0) {
dbffcd03d77a3fb Rik van Riel 2014-08-06 5119 #ifndef CONFIG_HAVE_IOREMAP_PROT
dbffcd03d77a3fb Rik van Riel 2014-08-06 5120 break;
dbffcd03d77a3fb Rik van Riel 2014-08-06 5121 #else
28b2ee20c7cba81 Rik van Riel 2008-07-23 5122 /*
28b2ee20c7cba81 Rik van Riel 2008-07-23 5123 * Check if this is a VM_IO |
VM_PFNMAP VMA, which
28b2ee20c7cba81 Rik van Riel 2008-07-23 5124 * we can access using slightly
different code.
28b2ee20c7cba81 Rik van Riel 2008-07-23 5125 */
3e418f9888463a8 Liam Howlett 2021-06-28 5126 vma = vma_lookup(mm, addr);
3e418f9888463a8 Liam Howlett 2021-06-28 5127 if (!vma)
28b2ee20c7cba81 Rik van Riel 2008-07-23 5128 break;
28b2ee20c7cba81 Rik van Riel 2008-07-23 5129 if (vma->vm_ops &&
vma->vm_ops->access)
28b2ee20c7cba81 Rik van Riel 2008-07-23 5130 ret =
vma->vm_ops->access(vma, addr, buf,
28b2ee20c7cba81 Rik van Riel 2008-07-23 5131 len, write);
0ec76a110f432e9 David Howells 2006-09-27 5132 if (ret <= 0)
0ec76a110f432e9 David Howells 2006-09-27 5133 break;
28b2ee20c7cba81 Rik van Riel 2008-07-23 5134 bytes = ret;
dbffcd03d77a3fb Rik van Riel 2014-08-06 5135 #endif
28b2ee20c7cba81 Rik van Riel 2008-07-23 5136 } else {
0ec76a110f432e9 David Howells 2006-09-27 5137 bytes = len;
0ec76a110f432e9 David Howells 2006-09-27 5138 offset = addr &
(PAGE_SIZE-1);
0ec76a110f432e9 David Howells 2006-09-27 5139 if (bytes >
PAGE_SIZE-offset)
0ec76a110f432e9 David Howells 2006-09-27 5140 bytes = PAGE_SIZE-offset;
0ec76a110f432e9 David Howells 2006-09-27 5141
0ec76a110f432e9 David Howells 2006-09-27 5142 maddr = kmap(page);
0ec76a110f432e9 David Howells 2006-09-27 5143 if (write) {
0ec76a110f432e9 David Howells 2006-09-27 @5144 copy_to_user_page(vma, page,
addr,
0ec76a110f432e9 David Howells 2006-09-27 5145 maddr + offset, buf,
bytes);
0ec76a110f432e9 David Howells 2006-09-27 5146 set_page_dirty_lock(page);
0ec76a110f432e9 David Howells 2006-09-27 5147 } else {
0ec76a110f432e9 David Howells 2006-09-27 @5148 copy_from_user_page(vma, page,
addr,
0ec76a110f432e9 David Howells 2006-09-27 5149 buf, maddr + offset,
bytes);
0ec76a110f432e9 David Howells 2006-09-27 5150 }
0ec76a110f432e9 David Howells 2006-09-27 5151 kunmap(page);
09cbfeaf1a5a67b Kirill A. Shutemov 2016-04-01 5152 put_page(page);
28b2ee20c7cba81 Rik van Riel 2008-07-23 5153 }
0ec76a110f432e9 David Howells 2006-09-27 5154 len -= bytes;
0ec76a110f432e9 David Howells 2006-09-27 5155 buf += bytes;
0ec76a110f432e9 David Howells 2006-09-27 5156 addr += bytes;
0ec76a110f432e9 David Howells 2006-09-27 5157 }
d8ed45c5dcd455f Michel Lespinasse 2020-06-08 5158 mmap_read_unlock(mm);
0ec76a110f432e9 David Howells 2006-09-27 5159
0ec76a110f432e9 David Howells 2006-09-27 5160 return buf - old_buf;
0ec76a110f432e9 David Howells 2006-09-27 5161 }
03252919b798910 Andi Kleen 2008-01-30 5162
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org