lkml.org 
[lkml]   [2021]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[arnd-playground:compat-alloc-user-space-10 1/40] kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces)
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git compat-alloc-user-space-10
head: 58da7172523fefac0902591b73596ce2b21e5038
commit: 5357a3311b528fbd96e088885c5c17a5ce670ad7 [1/40] kexec: avoid compat_alloc_user_space
config: i386-randconfig-s002-20210720 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=5357a3311b528fbd96e088885c5c17a5ce670ad7
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground compat-alloc-user-space-10
git checkout 5357a3311b528fbd96e088885c5c17a5ce670ad7
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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


sparse warnings: (new ones prefixed by >>)
>> kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct kexec_segment *segments @@ got struct kexec_segment [noderef] __user *segments @@
kernel/kexec.c:274:52: sparse: expected struct kexec_segment *segments
kernel/kexec.c:274:52: sparse: got struct kexec_segment [noderef] __user *segments

vim +274 kernel/kexec.c

6b27aef09fea32 Dominik Brodowski 2018-03-17 254
6b27aef09fea32 Dominik Brodowski 2018-03-17 255 SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
6b27aef09fea32 Dominik Brodowski 2018-03-17 256 struct kexec_segment __user *, segments, unsigned long, flags)
6b27aef09fea32 Dominik Brodowski 2018-03-17 257 {
5357a3311b528f Arnd Bergmann 2021-05-19 258 struct kexec_segment *ksegments;
5357a3311b528f Arnd Bergmann 2021-05-19 259 unsigned long bytes, result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 260
6b27aef09fea32 Dominik Brodowski 2018-03-17 261 result = kexec_load_check(nr_segments, flags);
6b27aef09fea32 Dominik Brodowski 2018-03-17 262 if (result)
6b27aef09fea32 Dominik Brodowski 2018-03-17 263 return result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 264
5357a3311b528f Arnd Bergmann 2021-05-19 265 bytes = nr_segments * sizeof(ksegments[0]);
5357a3311b528f Arnd Bergmann 2021-05-19 266 ksegments = kmalloc(bytes, GFP_KERNEL);
5357a3311b528f Arnd Bergmann 2021-05-19 267 if (!ksegments)
5357a3311b528f Arnd Bergmann 2021-05-19 268 return -ENOMEM;
6b27aef09fea32 Dominik Brodowski 2018-03-17 269
5357a3311b528f Arnd Bergmann 2021-05-19 270 result = copy_from_user(ksegments, segments, bytes);
5357a3311b528f Arnd Bergmann 2021-05-19 271 if (result)
5357a3311b528f Arnd Bergmann 2021-05-19 272 goto fail;
72414d3f1d22fc Maneesh Soni 2005-06-25 273
0eea08678ebe9f Minfei Huang 2016-05-23 @274 result = do_kexec_load(entry, nr_segments, segments, flags);
9b492cf58077a0 Xunlei Pang 2016-05-23 275
5357a3311b528f Arnd Bergmann 2021-05-19 276 fail:
5357a3311b528f Arnd Bergmann 2021-05-19 277 kfree(ksegments);
dc009d92435f99 Eric W. Biederman 2005-06-25 278 return result;
dc009d92435f99 Eric W. Biederman 2005-06-25 279 }
dc009d92435f99 Eric W. Biederman 2005-06-25 280

:::::: The code at line 274 was first introduced by commit
:::::: 0eea08678ebe9f7d8ef98fed974a5bf1a0dd2dd2 kexec: do a cleanup for function kexec_load

:::::: TO: Minfei Huang <mnfhuang@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-07-20 08:13    [W:0.032 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site