linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 6322/7526] arch/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2022-02-23 17:02 kernel test robot
  2022-02-23 19:22 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2022-02-23 17:02 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: kbuild-all, Linux Memory Management List, Christoph Hellwig

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   196d330d7fb1e7cc0d85641c89ce4602cb36f12e
commit: 27e8140d7819b7dce32967e4b5bba102b59196ee [6322/7526] uaccess: fix type mismatch warnings from access_ok()
config: riscv-randconfig-s032-20220223 (https://download.01.org/0day-ci/archive/20220224/202202240123.jVKXO4uv-lkp@intel.com/config)
compiler: riscv64-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/next/linux-next.git/commit/?id=27e8140d7819b7dce32967e4b5bba102b59196ee
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 27e8140d7819b7dce32967e4b5bba102b59196ee
        # 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=riscv SHELL=/bin/bash arch/riscv/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/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long [noderef] __user *user_frame_tail @@     got unsigned long * @@
   arch/riscv/kernel/perf_callchain.c:19:26: sparse:     expected unsigned long [noderef] __user *user_frame_tail
   arch/riscv/kernel/perf_callchain.c:19:26: sparse:     got unsigned long *

vim +19 arch/riscv/kernel/perf_callchain.c

dbeb90b0c1eb86 Mao Han       2019-08-29   8  
dbeb90b0c1eb86 Mao Han       2019-08-29   9  /*
dbeb90b0c1eb86 Mao Han       2019-08-29  10   * Get the return address for a single stackframe and return a pointer to the
dbeb90b0c1eb86 Mao Han       2019-08-29  11   * next frame tail.
dbeb90b0c1eb86 Mao Han       2019-08-29  12   */
dbeb90b0c1eb86 Mao Han       2019-08-29  13  static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry,
dbeb90b0c1eb86 Mao Han       2019-08-29  14  				    unsigned long fp, unsigned long reg_ra)
dbeb90b0c1eb86 Mao Han       2019-08-29  15  {
dbeb90b0c1eb86 Mao Han       2019-08-29  16  	struct stackframe buftail;
dbeb90b0c1eb86 Mao Han       2019-08-29  17  	unsigned long ra = 0;
27e8140d7819b7 Arnd Bergmann 2022-02-14  18  	unsigned long __user *user_frame_tail =
dbeb90b0c1eb86 Mao Han       2019-08-29 @19  			(unsigned long *)(fp - sizeof(struct stackframe));
dbeb90b0c1eb86 Mao Han       2019-08-29  20  
dbeb90b0c1eb86 Mao Han       2019-08-29  21  	/* Check accessibility of one struct frame_tail beyond */
dbeb90b0c1eb86 Mao Han       2019-08-29  22  	if (!access_ok(user_frame_tail, sizeof(buftail)))
dbeb90b0c1eb86 Mao Han       2019-08-29  23  		return 0;
dbeb90b0c1eb86 Mao Han       2019-08-29  24  	if (__copy_from_user_inatomic(&buftail, user_frame_tail,
dbeb90b0c1eb86 Mao Han       2019-08-29  25  				      sizeof(buftail)))
dbeb90b0c1eb86 Mao Han       2019-08-29  26  		return 0;
dbeb90b0c1eb86 Mao Han       2019-08-29  27  
dbeb90b0c1eb86 Mao Han       2019-08-29  28  	if (reg_ra != 0)
dbeb90b0c1eb86 Mao Han       2019-08-29  29  		ra = reg_ra;
dbeb90b0c1eb86 Mao Han       2019-08-29  30  	else
dbeb90b0c1eb86 Mao Han       2019-08-29  31  		ra = buftail.ra;
dbeb90b0c1eb86 Mao Han       2019-08-29  32  
dbeb90b0c1eb86 Mao Han       2019-08-29  33  	fp = buftail.fp;
dbeb90b0c1eb86 Mao Han       2019-08-29  34  	if (ra != 0)
dbeb90b0c1eb86 Mao Han       2019-08-29  35  		perf_callchain_store(entry, ra);
dbeb90b0c1eb86 Mao Han       2019-08-29  36  	else
dbeb90b0c1eb86 Mao Han       2019-08-29  37  		return 0;
dbeb90b0c1eb86 Mao Han       2019-08-29  38  
dbeb90b0c1eb86 Mao Han       2019-08-29  39  	return fp;
dbeb90b0c1eb86 Mao Han       2019-08-29  40  }
dbeb90b0c1eb86 Mao Han       2019-08-29  41  

:::::: The code at line 19 was first introduced by commit
:::::: dbeb90b0c1eb86a9b963b929d3c937afb7dadfa3 riscv: Add perf callchain support

:::::: TO: Mao Han <han_mao@c-sky.com>
:::::: CC: Paul Walmsley <paul.walmsley@sifive.com>

---
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

* Re: [linux-next:master 6322/7526] arch/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces)
  2022-02-23 17:02 [linux-next:master 6322/7526] arch/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
@ 2022-02-23 19:22 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2022-02-23 19:22 UTC (permalink / raw)
  To: kernel test robot
  Cc: Arnd Bergmann, kbuild-all, Linux Memory Management List,
	Christoph Hellwig

On Wed, Feb 23, 2022 at 6:02 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   196d330d7fb1e7cc0d85641c89ce4602cb36f12e
> commit: 27e8140d7819b7dce32967e4b5bba102b59196ee [6322/7526] uaccess: fix type mismatch warnings from access_ok()
> config: riscv-randconfig-s032-20220223 (https://download.01.org/0day-ci/archive/20220224/202202240123.jVKXO4uv-lkp@intel.com/config)
> compiler: riscv64-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/next/linux-next.git/commit/?id=27e8140d7819b7dce32967e4b5bba102b59196ee
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 27e8140d7819b7dce32967e4b5bba102b59196ee
>         # 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=riscv SHELL=/bin/bash arch/riscv/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/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long [noderef] __user *user_frame_tail @@     got unsigned long * @@
>    arch/riscv/kernel/perf_callchain.c:19:26: sparse:     expected unsigned long [noderef] __user *user_frame_tail
>    arch/riscv/kernel/perf_callchain.c:19:26: sparse:     got unsigned long *

Fixed now, thanks for the report!

         Arnd


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

end of thread, other threads:[~2022-02-23 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23 17:02 [linux-next:master 6322/7526] arch/riscv/kernel/perf_callchain.c:19:26: sparse: sparse: incorrect type in initializer (different address spaces) kernel test robot
2022-02-23 19:22 ` Arnd Bergmann

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