All of lore.kernel.org
 help / color / mirror / Atom feed
* [arnd-playground:set_fs-2 12/17] lib/test_lockup.c:422:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2022-02-16  8:26 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-02-16  8:26 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-2
head:   cb5b88c78bb9c229c93bf11ea66d622a3ba4bf2d
commit: 5c46fbe679aaca0b693101e743e46ba571403b7c [12/17] uaccess: fix type mismatch warnings from access_ok()
config: mips-randconfig-s031-20220216 (https://download.01.org/0day-ci/archive/20220216/202202161630.LUggdKp0-lkp@intel.com/config)
compiler: mips-linux-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=5c46fbe679aaca0b693101e743e46ba571403b7c
        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-2
        git checkout 5c46fbe679aaca0b693101e743e46ba571403b7c
        # 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=mips 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 >>)
   command-line: note: in included file:
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
   builtin:0:0: sparse: this was the original definition
>> lib/test_lockup.c:422:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gk_ptr @@     got void [noderef] __user *ptr @@
   lib/test_lockup.c:422:13: sparse:     expected char const *__gk_ptr
   lib/test_lockup.c:422:13: sparse:     got void [noderef] __user *ptr
>> lib/test_lockup.c:423:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gk_ptr @@     got void [noderef] __user * @@
   lib/test_lockup.c:423:13: sparse:     expected char const *__gk_ptr
   lib/test_lockup.c:423:13: sparse:     got void [noderef] __user *
   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 +422 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  {
5c46fbe679aaca Arnd Bergmann         2022-02-14  413  	void __user *ptr = (void __user *)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 422 was first introduced by commit
:::::: 25f12ae45fc1931a1dce3cc59f9989a9d87834b0 maccess: rename probe_kernel_address to get_kernel_nofault

:::::: TO: Christoph Hellwig <hch@lst.de>
:::::: 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] 2+ messages in thread

* [arnd-playground:set_fs-2 12/17] lib/test_lockup.c:422:13: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2022-02-16  8:26 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-02-16  8:26 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4842 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs-2
head:   cb5b88c78bb9c229c93bf11ea66d622a3ba4bf2d
commit: 5c46fbe679aaca0b693101e743e46ba571403b7c [12/17] uaccess: fix type mismatch warnings from access_ok()
config: mips-randconfig-s031-20220216 (https://download.01.org/0day-ci/archive/20220216/202202161630.LUggdKp0-lkp(a)intel.com/config)
compiler: mips-linux-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=5c46fbe679aaca0b693101e743e46ba571403b7c
        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-2
        git checkout 5c46fbe679aaca0b693101e743e46ba571403b7c
        # 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=mips 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 >>)
   command-line: note: in included file:
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
   builtin:0:0: sparse: this was the original definition
   builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
   builtin:0:0: sparse: this was the original definition
>> lib/test_lockup.c:422:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gk_ptr @@     got void [noderef] __user *ptr @@
   lib/test_lockup.c:422:13: sparse:     expected char const *__gk_ptr
   lib/test_lockup.c:422:13: sparse:     got void [noderef] __user *ptr
>> lib/test_lockup.c:423:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gk_ptr @@     got void [noderef] __user * @@
   lib/test_lockup.c:423:13: sparse:     expected char const *__gk_ptr
   lib/test_lockup.c:423:13: sparse:     got void [noderef] __user *
   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 +422 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  {
5c46fbe679aaca Arnd Bergmann         2022-02-14  413  	void __user *ptr = (void __user *)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 422 was first introduced by commit
:::::: 25f12ae45fc1931a1dce3cc59f9989a9d87834b0 maccess: rename probe_kernel_address to get_kernel_nofault

:::::: TO: Christoph Hellwig <hch@lst.de>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-16  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16  8:26 [arnd-playground:set_fs-2 12/17] lib/test_lockup.c:422:13: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
2022-02-16  8:26 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.