All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [arnd-playground:set_fs 2/11] mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
Date: Sun, 13 Feb 2022 12:43:35 +0800	[thread overview]
Message-ID: <202202131259.S6ZP2d9J-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7805 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs
head:   0a081326831928b0d739bce68b8c0f9138b9c8ba
commit: 872ec1b8b0c531c0367aa6f365149bf70d3bcd30 [2/11] sparc64: add __{get,put}_kernel_nocheck()
config: sparc64-randconfig-s032-20220213 (https://download.01.org/0day-ci/archive/20220213/202202131259.S6ZP2d9J-lkp(a)intel.com/config)
compiler: sparc64-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/playground.git/commit/?id=872ec1b8b0c531c0367aa6f365149bf70d3bcd30
        git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
        git fetch --no-tags arnd-playground set_fs
        git checkout 872ec1b8b0c531c0367aa6f365149bf70d3bcd30
        # 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=sparc64 SHELL=/bin/bash

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 >>)
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +37 mm/maccess.c

b58294ead14cde Christoph Hellwig 2020-06-08  16  
fe557319aa06c2 Christoph Hellwig 2020-06-17  17  #define copy_from_kernel_nofault_loop(dst, src, len, type, err_label)	\
b58294ead14cde Christoph Hellwig 2020-06-08  18  	while (len >= sizeof(type)) {					\
b58294ead14cde Christoph Hellwig 2020-06-08  19  		__get_kernel_nofault(dst, src, type, err_label);		\
b58294ead14cde Christoph Hellwig 2020-06-08  20  		dst += sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  21  		src += sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  22  		len -= sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  23  	}
b58294ead14cde Christoph Hellwig 2020-06-08  24  
fe557319aa06c2 Christoph Hellwig 2020-06-17  25  long copy_from_kernel_nofault(void *dst, const void *src, size_t size)
b58294ead14cde Christoph Hellwig 2020-06-08  26  {
2423de2e6f4d86 Arnd Bergmann     2021-08-11  27  	unsigned long align = 0;
2423de2e6f4d86 Arnd Bergmann     2021-08-11  28  
2423de2e6f4d86 Arnd Bergmann     2021-08-11  29  	if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
2423de2e6f4d86 Arnd Bergmann     2021-08-11  30  		align = (unsigned long)dst | (unsigned long)src;
2423de2e6f4d86 Arnd Bergmann     2021-08-11  31  
fe557319aa06c2 Christoph Hellwig 2020-06-17  32  	if (!copy_from_kernel_nofault_allowed(src, size))
2a71e81d321987 Christoph Hellwig 2020-06-08  33  		return -ERANGE;
b58294ead14cde Christoph Hellwig 2020-06-08  34  
b58294ead14cde Christoph Hellwig 2020-06-08  35  	pagefault_disable();
2423de2e6f4d86 Arnd Bergmann     2021-08-11  36  	if (!(align & 7))
fe557319aa06c2 Christoph Hellwig 2020-06-17 @37  		copy_from_kernel_nofault_loop(dst, src, size, u64, Efault);
2423de2e6f4d86 Arnd Bergmann     2021-08-11  38  	if (!(align & 3))
fe557319aa06c2 Christoph Hellwig 2020-06-17  39  		copy_from_kernel_nofault_loop(dst, src, size, u32, Efault);
2423de2e6f4d86 Arnd Bergmann     2021-08-11  40  	if (!(align & 1))
fe557319aa06c2 Christoph Hellwig 2020-06-17  41  		copy_from_kernel_nofault_loop(dst, src, size, u16, Efault);
fe557319aa06c2 Christoph Hellwig 2020-06-17  42  	copy_from_kernel_nofault_loop(dst, src, size, u8, Efault);
b58294ead14cde Christoph Hellwig 2020-06-08  43  	pagefault_enable();
b58294ead14cde Christoph Hellwig 2020-06-08  44  	return 0;
b58294ead14cde Christoph Hellwig 2020-06-08  45  Efault:
b58294ead14cde Christoph Hellwig 2020-06-08  46  	pagefault_enable();
b58294ead14cde Christoph Hellwig 2020-06-08  47  	return -EFAULT;
b58294ead14cde Christoph Hellwig 2020-06-08  48  }
fe557319aa06c2 Christoph Hellwig 2020-06-17  49  EXPORT_SYMBOL_GPL(copy_from_kernel_nofault);
b58294ead14cde Christoph Hellwig 2020-06-08  50  

:::::: The code at line 37 was first introduced by commit
:::::: fe557319aa06c23cffc9346000f119547e0f289a maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault

:::::: TO: Christoph Hellwig <hch@lst.de>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [arnd-playground:set_fs 2/11] mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
Date: Sun, 13 Feb 2022 12:43:35 +0800	[thread overview]
Message-ID: <202202131259.S6ZP2d9J-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs
head:   0a081326831928b0d739bce68b8c0f9138b9c8ba
commit: 872ec1b8b0c531c0367aa6f365149bf70d3bcd30 [2/11] sparc64: add __{get,put}_kernel_nocheck()
config: sparc64-randconfig-s032-20220213 (https://download.01.org/0day-ci/archive/20220213/202202131259.S6ZP2d9J-lkp@intel.com/config)
compiler: sparc64-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/playground.git/commit/?id=872ec1b8b0c531c0367aa6f365149bf70d3bcd30
        git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
        git fetch --no-tags arnd-playground set_fs
        git checkout 872ec1b8b0c531c0367aa6f365149bf70d3bcd30
        # 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=sparc64 SHELL=/bin/bash

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 >>)
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
>> mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:39:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:41:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:42:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:68:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:70:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:72:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:73:9: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression
   mm/maccess.c:92:17: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +37 mm/maccess.c

b58294ead14cde Christoph Hellwig 2020-06-08  16  
fe557319aa06c2 Christoph Hellwig 2020-06-17  17  #define copy_from_kernel_nofault_loop(dst, src, len, type, err_label)	\
b58294ead14cde Christoph Hellwig 2020-06-08  18  	while (len >= sizeof(type)) {					\
b58294ead14cde Christoph Hellwig 2020-06-08  19  		__get_kernel_nofault(dst, src, type, err_label);		\
b58294ead14cde Christoph Hellwig 2020-06-08  20  		dst += sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  21  		src += sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  22  		len -= sizeof(type);					\
b58294ead14cde Christoph Hellwig 2020-06-08  23  	}
b58294ead14cde Christoph Hellwig 2020-06-08  24  
fe557319aa06c2 Christoph Hellwig 2020-06-17  25  long copy_from_kernel_nofault(void *dst, const void *src, size_t size)
b58294ead14cde Christoph Hellwig 2020-06-08  26  {
2423de2e6f4d86 Arnd Bergmann     2021-08-11  27  	unsigned long align = 0;
2423de2e6f4d86 Arnd Bergmann     2021-08-11  28  
2423de2e6f4d86 Arnd Bergmann     2021-08-11  29  	if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS))
2423de2e6f4d86 Arnd Bergmann     2021-08-11  30  		align = (unsigned long)dst | (unsigned long)src;
2423de2e6f4d86 Arnd Bergmann     2021-08-11  31  
fe557319aa06c2 Christoph Hellwig 2020-06-17  32  	if (!copy_from_kernel_nofault_allowed(src, size))
2a71e81d321987 Christoph Hellwig 2020-06-08  33  		return -ERANGE;
b58294ead14cde Christoph Hellwig 2020-06-08  34  
b58294ead14cde Christoph Hellwig 2020-06-08  35  	pagefault_disable();
2423de2e6f4d86 Arnd Bergmann     2021-08-11  36  	if (!(align & 7))
fe557319aa06c2 Christoph Hellwig 2020-06-17 @37  		copy_from_kernel_nofault_loop(dst, src, size, u64, Efault);
2423de2e6f4d86 Arnd Bergmann     2021-08-11  38  	if (!(align & 3))
fe557319aa06c2 Christoph Hellwig 2020-06-17  39  		copy_from_kernel_nofault_loop(dst, src, size, u32, Efault);
2423de2e6f4d86 Arnd Bergmann     2021-08-11  40  	if (!(align & 1))
fe557319aa06c2 Christoph Hellwig 2020-06-17  41  		copy_from_kernel_nofault_loop(dst, src, size, u16, Efault);
fe557319aa06c2 Christoph Hellwig 2020-06-17  42  	copy_from_kernel_nofault_loop(dst, src, size, u8, Efault);
b58294ead14cde Christoph Hellwig 2020-06-08  43  	pagefault_enable();
b58294ead14cde Christoph Hellwig 2020-06-08  44  	return 0;
b58294ead14cde Christoph Hellwig 2020-06-08  45  Efault:
b58294ead14cde Christoph Hellwig 2020-06-08  46  	pagefault_enable();
b58294ead14cde Christoph Hellwig 2020-06-08  47  	return -EFAULT;
b58294ead14cde Christoph Hellwig 2020-06-08  48  }
fe557319aa06c2 Christoph Hellwig 2020-06-17  49  EXPORT_SYMBOL_GPL(copy_from_kernel_nofault);
b58294ead14cde Christoph Hellwig 2020-06-08  50  

:::::: The code at line 37 was first introduced by commit
:::::: fe557319aa06c23cffc9346000f119547e0f289a maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault

:::::: TO: Christoph Hellwig <hch@lst.de>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

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

             reply	other threads:[~2022-02-13  4:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-13  4:43 kernel test robot [this message]
2022-02-13  4:43 ` [arnd-playground:set_fs 2/11] mm/maccess.c:37:17: sparse: sparse: cast removes address space '__user' of expression kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202202131259.S6ZP2d9J-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.