Re: [char-misc:char-misc-next 28/28] drivers/char/mem.c:737:21: sparse: sparse: incorrect type in argument 1 (different address spaces)

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

 



On Sun, Sep 06, 2020 at 05:14:15AM +0800, kernel test robot wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next
head:   99f667352f6c938440d9043d0f66f859d6f3d50d
commit: 99f667352f6c938440d9043d0f66f859d6f3d50d [28/28] /dev/zero: also implement ->read
config: m68k-randconfig-s031-20200904 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

Looks like m68 does not have proper __user annotations for clear_user..

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.2-191-g10164920-dirty
        git checkout 99f667352f6c938440d9043d0f66f859d6f3d50d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)

   drivers/char/mem.c:163:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got char [noderef] __user *buf @@
   drivers/char/mem.c:163:37: sparse:     expected void *to
   drivers/char/mem.c:163:37: sparse:     got char [noderef] __user *buf
drivers/char/mem.c:737:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got char [noderef] __user * @@
   drivers/char/mem.c:737:21: sparse:     expected void *to
drivers/char/mem.c:737:21: sparse:     got char [noderef] __user *

# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?id=99f667352f6c938440d9043d0f66f859d6f3d50d
git remote add char-misc https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git fetch --no-tags char-misc char-misc-next
git checkout 99f667352f6c938440d9043d0f66f859d6f3d50d
vim +737 drivers/char/mem.c

   728	
   729	static ssize_t read_zero(struct file *file, char __user *buf,
   730				 size_t count, loff_t *ppos)
   731	{
   732		size_t cleared = 0;
   733	
   734		while (count) {
   735			size_t chunk = min_t(size_t, count, PAGE_SIZE);
   736	
 > 737			if (clear_user(buf + cleared, chunk))
   738				return cleared ? cleared : -EFAULT;
   739			cleared += chunk;
   740			count -= chunk;
   741	
   742			if (signal_pending(current))
   743				return cleared ? cleared : -ERESTARTSYS;
   744			cond_resched();
   745		}
   746	
   747		return cleared;
   748	}
   749	

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


---end quoted text---



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux