[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202204070638.ssZOY65E-lkp@intel.com>
Date: Thu, 7 Apr 2022 06:51:07 +0800
From: kernel test robot <lkp@...el.com>
To: Kees Cook <keescook@...omium.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/video/fbdev/core/fbmem.c:885:17: sparse: sparse: incorrect
type in argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3e732ebf7316ac83e8562db7e64cc68aec390a18
commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
date: 7 weeks ago
config: mips-randconfig-s032-20220405 (https://download.01.org/0day-ci/archive/20220407/202204070638.ssZOY65E-lkp@intel.com/config)
compiler: mips64el-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/torvalds/linux.git/commit/?id=f68f2ff91512c199ec24883001245912afc17873
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f68f2ff91512c199ec24883001245912afc17873
# 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 drivers/video/fbdev/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.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
drivers/video/fbdev/core/fbmem.c:808:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] src @@
drivers/video/fbdev/core/fbmem.c:808:17: sparse: expected void const *
drivers/video/fbdev/core/fbmem.c:808:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] src
drivers/video/fbdev/core/fbmem.c:808:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] src @@
drivers/video/fbdev/core/fbmem.c:808:17: sparse: expected void const *
drivers/video/fbdev/core/fbmem.c:808:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] src
drivers/video/fbdev/core/fbmem.c:808:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] src @@
drivers/video/fbdev/core/fbmem.c:808:17: sparse: expected void const *
drivers/video/fbdev/core/fbmem.c:808:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] src
>> drivers/video/fbdev/core/fbmem.c:885:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] dst @@
drivers/video/fbdev/core/fbmem.c:885:17: sparse: expected void const *
drivers/video/fbdev/core/fbmem.c:885:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] dst
>> drivers/video/fbdev/core/fbmem.c:885:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] dst @@
drivers/video/fbdev/core/fbmem.c:885:17: sparse: expected void const *
drivers/video/fbdev/core/fbmem.c:885:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] dst
drivers/video/fbdev/core/fbmem.c:885:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got unsigned char [noderef] [usertype] __iomem *[assigned] dst @@
drivers/video/fbdev/core/fbmem.c:885:17: sparse: expected void *
drivers/video/fbdev/core/fbmem.c:885:17: sparse: got unsigned char [noderef] [usertype] __iomem *[assigned] dst
vim +885 drivers/video/fbdev/core/fbmem.c
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 826
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 827 static ssize_t
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 828 fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 829 {
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 830 unsigned long p = *ppos;
c47747fde931c02 drivers/video/fbmem.c Linus Torvalds 2011-05-11 831 struct fb_info *info = file_fb_info(file);
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 832 u8 *buffer, *src;
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 833 u8 __iomem *dst;
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 834 int c, cnt = 0, err = 0;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 835 unsigned long total_size;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 836
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 837 if (!info || !info->screen_base)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 838 return -ENODEV;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 839
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 840 if (info->state != FBINFO_STATE_RUNNING)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 841 return -EPERM;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 842
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 843 if (info->fbops->fb_write)
3f9b0880e4a96b0 drivers/video/fbmem.c Antonino A. Daplas 2007-05-08 844 return info->fbops->fb_write(info, buf, count, ppos);
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 845
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 846 total_size = info->screen_size;
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 847
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 848 if (total_size == 0)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 849 total_size = info->fix.smem_len;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 850
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 851 if (p > total_size)
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 852 return -EFBIG;
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 853
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 854 if (count > total_size) {
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 855 err = -EFBIG;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 856 count = total_size;
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 857 }
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 858
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 859 if (count + p > total_size) {
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 860 if (!err)
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 861 err = -ENOSPC;
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 862
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 863 count = total_size - p;
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 864 }
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 865
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 866 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 867 GFP_KERNEL);
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 868 if (!buffer)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 869 return -ENOMEM;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 870
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 871 dst = (u8 __iomem *) (info->screen_base + p);
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 872
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 873 if (info->fbops->fb_sync)
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 874 info->fbops->fb_sync(info);
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 875
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 876 while (count) {
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 877 c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 878 src = buffer;
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 879
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 880 if (copy_from_user(src, buf, c)) {
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 881 err = -EFAULT;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 882 break;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 883 }
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 884
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 @885 fb_memcpy_tofb(dst, src, c);
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 886 dst += c;
f11b478d461b711 drivers/video/fbmem.c James Hogan 2010-10-27 887 src += c;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 888 *ppos += c;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 889 buf += c;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 890 cnt += c;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 891 count -= c;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 892 }
0a484a3af905a25 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 893
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 894 kfree(buffer);
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 895
6a2a88668e90cd2 drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 896 return (cnt) ? cnt : err;
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 897 }
^1da177e4c3f415 drivers/video/fbmem.c Linus Torvalds 2005-04-16 898
:::::: The code at line 885 was first introduced by commit
:::::: f11b478d461b7113eb4603b3914aaf15b7788e87 fbmem: fix fb_read, fb_write unaligned accesses
:::::: TO: James Hogan <james@...anarts.com>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists