The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [arnd-playground:set_fs 6/11] lib/test_lockup.c:420:13: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2022-02-13  7:37 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-02-13  7:37 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:   0a081326831928b0d739bce68b8c0f9138b9c8ba
commit: a954036380ae20dbfa0c203bf6cafb21d1f3cedd [6/11] uaccess: generalize access_ok()
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220213/202202131523.w4Vvi8jc-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=a954036380ae20dbfa0c203bf6cafb21d1f3cedd
        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 a954036380ae20dbfa0c203bf6cafb21d1f3cedd
        # 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=i386 SHELL=/bin/bash

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 >>)
>> lib/test_lockup.c:420:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got void *ptr @@
   lib/test_lockup.c:420:13: sparse:     expected void const [noderef] __user *ptr
   lib/test_lockup.c:420:13: sparse:     got void *ptr
>> lib/test_lockup.c:421:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got void * @@
   lib/test_lockup.c:421:13: sparse:     expected void const [noderef] __user *ptr
   lib/test_lockup.c:421:13: sparse:     got void *
   lib/test_lockup.c:230:9: sparse: sparse: context imbalance in 'test_lock' - wrong count at exit
   lib/test_lockup.c:250:25: sparse: sparse: context imbalance in 'test_unlock' - unexpected unlock

vim +420 lib/test_lockup.c

30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  410  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  411  static bool test_kernel_ptr(unsigned long addr, int size)
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  412  {
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  413  	void *ptr = (void *)addr;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  414  	char buf;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  415  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  416  	if (!addr)
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  417  		return false;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  418  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  419  	/* should be at least readable kernel address */
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06 @420  	if (access_ok(ptr, 1) ||
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06 @421  	    access_ok(ptr + size - 1, 1) ||
25f12ae45fc193 Christoph Hellwig     2020-06-17  422  	    get_kernel_nofault(buf, ptr) ||
25f12ae45fc193 Christoph Hellwig     2020-06-17  423  	    get_kernel_nofault(buf, ptr + size - 1)) {
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  424  		pr_err("invalid kernel ptr: %#lx\n", addr);
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  425  		return true;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  426  	}
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  427  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  428  	return false;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  429  }
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  430  

:::::: The code at line 420 was first introduced by commit
:::::: 30428ef5d1e8caf78639cc70a802f1cb7b1cec04 lib/test_lockup: test module to generate lockups

:::::: TO: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
:::::: 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-13  7:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-13  7:37 [arnd-playground:set_fs 6/11] lib/test_lockup.c:420:13: 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