lkml.org 
[lkml]   [2022]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    Subjectdrivers/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: af3e9579ecfbe1796334bb25a2f0a6437983673a
    commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
    date: 6 months ago
    config: mips-randconfig-s042-20220807 (https://download.01.org/0day-ci/archive/20220807/202208070524.5P8ADxzG-lkp@intel.com/config)
    compiler: mips-linux-gcc (GCC) 12.1.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-39-gce1a6720-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
    mkdir build_dir && cp config build_dir/.config
    COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/video/fbdev/core/

    If you fix the issue, kindly add following tag where applicable
    Reported-by: kernel test robot <lkp@intel.com>

    sparse warnings: (new ones prefixed by >>)
    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

    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 826
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 827 static ssize_t
    ^1da177e4c3f41 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)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 829 {
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 830 unsigned long p = *ppos;
    c47747fde931c0 drivers/video/fbmem.c Linus Torvalds 2011-05-11 831 struct fb_info *info = file_fb_info(file);
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 832 u8 *buffer, *src;
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 833 u8 __iomem *dst;
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 834 int c, cnt = 0, err = 0;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 835 unsigned long total_size;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 836
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 837 if (!info || !info->screen_base)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 838 return -ENODEV;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 839
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 840 if (info->state != FBINFO_STATE_RUNNING)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 841 return -EPERM;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 842
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 843 if (info->fbops->fb_write)
    3f9b0880e4a96b drivers/video/fbmem.c Antonino A. Daplas 2007-05-08 844 return info->fbops->fb_write(info, buf, count, ppos);
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 845
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 846 total_size = info->screen_size;
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 847
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 848 if (total_size == 0)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 849 total_size = info->fix.smem_len;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 850
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 851 if (p > total_size)
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 852 return -EFBIG;
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 853
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 854 if (count > total_size) {
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 855 err = -EFBIG;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 856 count = total_size;
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 857 }
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 858
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 859 if (count + p > total_size) {
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 860 if (!err)
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 861 err = -ENOSPC;
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 862
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 863 count = total_size - p;
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 864 }
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 865
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 866 buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 867 GFP_KERNEL);
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 868 if (!buffer)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 869 return -ENOMEM;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 870
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 871 dst = (u8 __iomem *) (info->screen_base + p);
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 872
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 873 if (info->fbops->fb_sync)
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 874 info->fbops->fb_sync(info);
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 875
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 876 while (count) {
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 877 c = (count > PAGE_SIZE) ? PAGE_SIZE : count;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 878 src = buffer;
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 879
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 880 if (copy_from_user(src, buf, c)) {
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 881 err = -EFAULT;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 882 break;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 883 }
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 884
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 @885 fb_memcpy_tofb(dst, src, c);
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 886 dst += c;
    f11b478d461b71 drivers/video/fbmem.c James Hogan 2010-10-27 887 src += c;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 888 *ppos += c;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 889 buf += c;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 890 cnt += c;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 891 count -= c;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 892 }
    0a484a3af905a2 drivers/video/fbmem.c Antonino A. Daplas 2006-01-09 893
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 894 kfree(buffer);
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 895
    6a2a88668e90cd drivers/video/fbmem.c Antonino A. Daplas 2006-04-18 896 return (cnt) ? cnt : err;
    ^1da177e4c3f41 drivers/video/fbmem.c Linus Torvalds 2005-04-16 897 }
    ^1da177e4c3f41 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@albanarts.com>
    :::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

    --
    0-DAY CI Kernel Test Service
    https://01.org/lkp

    \
     
     \ /
      Last update: 2022-08-07 00:03    [W:3.158 / U:0.332 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site