All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [intel-lts:4.19/android_s 1/2] lib/usercopy.c:64:9: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Tue, 9 Apr 2024 16:46:14 +0800	[thread overview]
Message-ID: <202404091648.NSToEhRO-lkp@intel.com> (raw)

tree:   https://android.googlesource.com/kernel/common 4.19/android_s
head:   71b63f21a8292ca960a4c363d69d5e95c0265597
commit: 6a1e36af9d0e008f78f324581e5f1cb5c4393aee [1/2] BACKPORT: lib: introduce copy_struct_from_user() helper
config: m68k-randconfig-r123-20240406 (https://download.01.org/0day-ci/archive/20240409/202404091648.NSToEhRO-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240409/202404091648.NSToEhRO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404091648.NSToEhRO-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> lib/usercopy.c:64:9: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const *__gu_ptr @@     got unsigned long [noderef] <asn:1> * @@
   lib/usercopy.c:64:9: sparse:     expected void const *__gu_ptr
   lib/usercopy.c:64:9: sparse:     got unsigned long [noderef] <asn:1> *
   lib/usercopy.c:75:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected void const *__gu_ptr @@     got unsigned long [noderef] <asn:1> * @@
   lib/usercopy.c:75:17: sparse:     expected void const *__gu_ptr
   lib/usercopy.c:75:17: sparse:     got unsigned long [noderef] <asn:1> *

vim +64 lib/usercopy.c

    35	
    36	/**
    37	 * check_zeroed_user: check if a userspace buffer only contains zero bytes
    38	 * @from: Source address, in userspace.
    39	 * @size: Size of buffer.
    40	 *
    41	 * This is effectively shorthand for "memchr_inv(from, 0, size) == NULL" for
    42	 * userspace addresses (and is more efficient because we don't care where the
    43	 * first non-zero byte is).
    44	 *
    45	 * Returns:
    46	 *  * 0: There were non-zero bytes present in the buffer.
    47	 *  * 1: The buffer was full of zero bytes.
    48	 *  * -EFAULT: access to userspace failed.
    49	 */
    50	int check_zeroed_user(const void __user *from, size_t size)
    51	{
    52		unsigned long val;
    53		uintptr_t align = (uintptr_t) from % sizeof(unsigned long);
    54	
    55		if (unlikely(size == 0))
    56			return 1;
    57	
    58		from -= align;
    59		size += align;
    60	
    61		if (!user_access_begin(VERIFY_READ, from, size))
    62			return -EFAULT;
    63	
  > 64		unsafe_get_user(val, (unsigned long __user *) from, err_fault);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-04-09  8:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202404091648.NSToEhRO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.