mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [arnd-playground:set_fs 6/11] arch/arc/kernel/process.c:63:15: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2022-02-14  0:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-02-14  0:55 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs
head:   2a0bc55bf1de54742196464620860bbc46592f11
commit: e7e49ac844a31b9eebb95e85b0e20696aa646280 [6/11] uaccess: generalize access_ok()
config: arc-randconfig-s031-20220213 (https://download.01.org/0day-ci/archive/20220214/202202140815.nUkV6yfz-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=e7e49ac844a31b9eebb95e85b0e20696aa646280
        git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
        git fetch --no-tags arnd-playground set_fs
        git checkout e7e49ac844a31b9eebb95e85b0e20696aa646280
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arc SHELL=/bin/bash arch/arc/kernel/

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 >>)
>> arch/arc/kernel/process.c:63:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got int *uaddr @@
   arch/arc/kernel/process.c:63:15: sparse:     expected void const [noderef] __user *ptr
   arch/arc/kernel/process.c:63:15: sparse:     got int *uaddr
   arch/arc/kernel/process.c:70:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int *uaddr @@
   arch/arc/kernel/process.c:70:15: sparse:     expected void const volatile [noderef] __user *ptr
   arch/arc/kernel/process.c:70:15: sparse:     got int *uaddr
   arch/arc/kernel/process.c:77:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got int *uaddr @@
   arch/arc/kernel/process.c:77:15: sparse:     expected void const volatile [noderef] __user *ptr
   arch/arc/kernel/process.c:77:15: sparse:     got int *uaddr

vim +63 arch/arc/kernel/process.c

bf90e1eab682dc Vineet Gupta      2013-01-18   45  
91e040a79df73d Vineet Gupta      2016-10-20   46  SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
91e040a79df73d Vineet Gupta      2016-10-20   47  {
e6e335bf3a400b Vineet Gupta      2016-11-07   48  	struct pt_regs *regs = current_pt_regs();
e8708786d4fe21 Peter Zijlstra    2018-06-19   49  	u32 uval;
e8708786d4fe21 Peter Zijlstra    2018-06-19   50  	int ret;
91e040a79df73d Vineet Gupta      2016-10-20   51  
91e040a79df73d Vineet Gupta      2016-10-20   52  	/*
f79f7a2d96769d Bhaskar Chowdhury 2021-03-22   53  	 * This is only for old cores lacking LLOCK/SCOND, which by definition
91e040a79df73d Vineet Gupta      2016-10-20   54  	 * can't possibly be SMP. Thus doesn't need to be SMP safe.
91e040a79df73d Vineet Gupta      2016-10-20   55  	 * And this also helps reduce the overhead for serializing in
91e040a79df73d Vineet Gupta      2016-10-20   56  	 * the UP case
91e040a79df73d Vineet Gupta      2016-10-20   57  	 */
91e040a79df73d Vineet Gupta      2016-10-20   58  	WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP));
91e040a79df73d Vineet Gupta      2016-10-20   59  
f79f7a2d96769d Bhaskar Chowdhury 2021-03-22   60  	/* Z indicates to userspace if operation succeeded */
e6e335bf3a400b Vineet Gupta      2016-11-07   61  	regs->status32 &= ~STATUS_Z_MASK;
e6e335bf3a400b Vineet Gupta      2016-11-07   62  
96d4f267e40f95 Linus Torvalds    2019-01-03  @63  	ret = access_ok(uaddr, sizeof(*uaddr));
e8708786d4fe21 Peter Zijlstra    2018-06-19   64  	if (!ret)
e8708786d4fe21 Peter Zijlstra    2018-06-19   65  		 goto fail;
91e040a79df73d Vineet Gupta      2016-10-20   66  
e8708786d4fe21 Peter Zijlstra    2018-06-19   67  again:
91e040a79df73d Vineet Gupta      2016-10-20   68  	preempt_disable();
91e040a79df73d Vineet Gupta      2016-10-20   69  
e8708786d4fe21 Peter Zijlstra    2018-06-19   70  	ret = __get_user(uval, uaddr);
e8708786d4fe21 Peter Zijlstra    2018-06-19   71  	if (ret)
e8708786d4fe21 Peter Zijlstra    2018-06-19   72  		 goto fault;
e8708786d4fe21 Peter Zijlstra    2018-06-19   73  
e8708786d4fe21 Peter Zijlstra    2018-06-19   74  	if (uval != expected)
e8708786d4fe21 Peter Zijlstra    2018-06-19   75  		 goto out;
e8708786d4fe21 Peter Zijlstra    2018-06-19   76  
e8708786d4fe21 Peter Zijlstra    2018-06-19   77  	ret = __put_user(new, uaddr);
e8708786d4fe21 Peter Zijlstra    2018-06-19   78  	if (ret)
e8708786d4fe21 Peter Zijlstra    2018-06-19   79  		 goto fault;
91e040a79df73d Vineet Gupta      2016-10-20   80  
e6e335bf3a400b Vineet Gupta      2016-11-07   81  	regs->status32 |= STATUS_Z_MASK;
91e040a79df73d Vineet Gupta      2016-10-20   82  
e8708786d4fe21 Peter Zijlstra    2018-06-19   83  out:
91e040a79df73d Vineet Gupta      2016-10-20   84  	preempt_enable();
e6e335bf3a400b Vineet Gupta      2016-11-07   85  	return uval;
e8708786d4fe21 Peter Zijlstra    2018-06-19   86  
e8708786d4fe21 Peter Zijlstra    2018-06-19   87  fault:
e8708786d4fe21 Peter Zijlstra    2018-06-19   88  	preempt_enable();
e8708786d4fe21 Peter Zijlstra    2018-06-19   89  
e8708786d4fe21 Peter Zijlstra    2018-06-19   90  	if (unlikely(ret != -EFAULT))
e8708786d4fe21 Peter Zijlstra    2018-06-19   91  		 goto fail;
e8708786d4fe21 Peter Zijlstra    2018-06-19   92  
d8ed45c5dcd455 Michel Lespinasse 2020-06-08   93  	mmap_read_lock(current->mm);
64019a2e467a28 Peter Xu          2020-08-11   94  	ret = fixup_user_fault(current->mm, (unsigned long) uaddr,
e8708786d4fe21 Peter Zijlstra    2018-06-19   95  			       FAULT_FLAG_WRITE, NULL);
d8ed45c5dcd455 Michel Lespinasse 2020-06-08   96  	mmap_read_unlock(current->mm);
e8708786d4fe21 Peter Zijlstra    2018-06-19   97  
e8708786d4fe21 Peter Zijlstra    2018-06-19   98  	if (likely(!ret))
e8708786d4fe21 Peter Zijlstra    2018-06-19   99  		 goto again;
e8708786d4fe21 Peter Zijlstra    2018-06-19  100  
e8708786d4fe21 Peter Zijlstra    2018-06-19  101  fail:
3cf5d076fb4d48 Eric W. Biederman 2019-05-23  102  	force_sig(SIGSEGV);
e8708786d4fe21 Peter Zijlstra    2018-06-19  103  	return ret;
91e040a79df73d Vineet Gupta      2016-10-20  104  }
91e040a79df73d Vineet Gupta      2016-10-20  105  

:::::: The code at line 63 was first introduced by commit
:::::: 96d4f267e40f9509e8a66e2b39e8b95655617693 Remove 'type' argument from access_ok() function

:::::: TO: Linus Torvalds <torvalds@linux-foundation.org>
:::::: 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-14  0:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14  0:55 [arnd-playground:set_fs 6/11] arch/arc/kernel/process.c:63:15: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®