[arnd-asm-generic:set_fs-3 13/18] arch/csky/kernel/perf_callchain.c:55:14: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git set_fs-3
head:   81ba80d2dbd7f4536edb20b54754ad03b910e4aa
commit: 189d2606eda6b4611e560224718cd82dea30ffd0 [13/18] uaccess: generalize access_ok()
config: csky-randconfig-s032-20220221 (https://download.01.org/0day-ci/archive/20220221/202202212337.Vmr94Qq8-lkp@xxxxxxxxx/config)
compiler: csky-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/asm-generic.git/commit/?id=189d2606eda6b4611e560224718cd82dea30ffd0
        git remote add arnd-asm-generic https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
        git fetch --no-tags arnd-asm-generic set_fs-3
        git checkout 189d2606eda6b4611e560224718cd82dea30ffd0
        # 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=csky SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> arch/csky/kernel/perf_callchain.c:55:14: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got unsigned long *user_frame_tail @@
   arch/csky/kernel/perf_callchain.c:55:14: sparse:     expected void const [noderef] __user *ptr
   arch/csky/kernel/perf_callchain.c:55:14: sparse:     got unsigned long *user_frame_tail
   arch/csky/kernel/perf_callchain.c:57:49: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got unsigned long *user_frame_tail @@
   arch/csky/kernel/perf_callchain.c:57:49: sparse:     expected void const [noderef] __user *from
   arch/csky/kernel/perf_callchain.c:57:49: sparse:     got unsigned long *user_frame_tail
   arch/csky/kernel/perf_callchain.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/ptrace.h, ...):
   include/linux/uaccess.h:96:39: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   include/linux/uaccess.h:96:39: sparse:     expected void const *from
   include/linux/uaccess.h:96:39: sparse:     got void const [noderef] __user *from

vim +55 arch/csky/kernel/perf_callchain.c

cfa4d93b977a1b Mao Han 2019-02-21  42  
cfa4d93b977a1b Mao Han 2019-02-21  43  /*
cfa4d93b977a1b Mao Han 2019-02-21  44   * Get the return address for a single stackframe and return a pointer to the
cfa4d93b977a1b Mao Han 2019-02-21  45   * next frame tail.
cfa4d93b977a1b Mao Han 2019-02-21  46   */
cfa4d93b977a1b Mao Han 2019-02-21  47  static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry,
cfa4d93b977a1b Mao Han 2019-02-21  48  			unsigned long fp, unsigned long reg_lr)
cfa4d93b977a1b Mao Han 2019-02-21  49  {
cfa4d93b977a1b Mao Han 2019-02-21  50  	struct stackframe buftail;
cfa4d93b977a1b Mao Han 2019-02-21  51  	unsigned long lr = 0;
cfa4d93b977a1b Mao Han 2019-02-21  52  	unsigned long *user_frame_tail = (unsigned long *)fp;
cfa4d93b977a1b Mao Han 2019-02-21  53  
cfa4d93b977a1b Mao Han 2019-02-21  54  	/* Check accessibility of one struct frame_tail beyond */
cfa4d93b977a1b Mao Han 2019-02-21 @55  	if (!access_ok(user_frame_tail, sizeof(buftail)))
cfa4d93b977a1b Mao Han 2019-02-21  56  		return 0;
cfa4d93b977a1b Mao Han 2019-02-21  57  	if (__copy_from_user_inatomic(&buftail, user_frame_tail,
cfa4d93b977a1b Mao Han 2019-02-21  58  				      sizeof(buftail)))
cfa4d93b977a1b Mao Han 2019-02-21  59  		return 0;
cfa4d93b977a1b Mao Han 2019-02-21  60  
cfa4d93b977a1b Mao Han 2019-02-21  61  	if (reg_lr != 0)
cfa4d93b977a1b Mao Han 2019-02-21  62  		lr = reg_lr;
cfa4d93b977a1b Mao Han 2019-02-21  63  	else
cfa4d93b977a1b Mao Han 2019-02-21  64  		lr = buftail.lr;
cfa4d93b977a1b Mao Han 2019-02-21  65  
cfa4d93b977a1b Mao Han 2019-02-21  66  	fp = buftail.fp;
cfa4d93b977a1b Mao Han 2019-02-21  67  	perf_callchain_store(entry, lr);
cfa4d93b977a1b Mao Han 2019-02-21  68  
cfa4d93b977a1b Mao Han 2019-02-21  69  	return fp;
cfa4d93b977a1b Mao Han 2019-02-21  70  }
cfa4d93b977a1b Mao Han 2019-02-21  71  

:::::: The code at line 55 was first introduced by commit
:::::: cfa4d93b977a1b1129e7207d11b5daecdf0c56c4 csky: Add perf callchain support

:::::: TO: Mao Han <han_mao@xxxxxxxxx>
:::::: CC: Guo Ren <ren_guo@xxxxxxxxx>

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



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux