From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [linux-next:master 3828/8750] kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Fri, 27 Nov 2020 19:39:25 +0800 [thread overview]
Message-ID: <202011271922.wHRxAlDP-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4377 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 6147c83fd749d19a0d3ccc2f64d12138ab010b47
commit: 5329722057d41aebc31e391907a501feaa42f7d9 [3828/8750] bpf: Assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO
config: csky-randconfig-s032-20201127 (attached as .config)
compiler: csky-linux-gcc (GCC) 9.3.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.3-151-g540c2c4b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5329722057d41aebc31e391907a501feaa42f7d9
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 5329722057d41aebc31e391907a501feaa42f7d9
# 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=csky
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 >>)"
kernel/bpf/btf.c:2535:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:2537:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:3314:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:3655:9: sparse: sparse: Using plain integer as NULL pointer
>> kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char *__pu_addr @@ got char [noderef] __user * @@
>> kernel/bpf/btf.c:5603:29: sparse: expected char *__pu_addr
>> kernel/bpf/btf.c:5603:29: sparse: got char [noderef] __user *
kernel/bpf/btf.c:5611:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] __user * @@
kernel/bpf/btf.c:5611:13: sparse: expected unsigned int *__pu_addr
kernel/bpf/btf.c:5611:13: sparse: got unsigned int [noderef] __user *
vim +5603 kernel/bpf/btf.c
5556
5557 int btf_get_info_by_fd(const struct btf *btf,
5558 const union bpf_attr *attr,
5559 union bpf_attr __user *uattr)
5560 {
5561 struct bpf_btf_info __user *uinfo;
5562 struct bpf_btf_info info;
5563 u32 info_copy, btf_copy;
5564 void __user *ubtf;
5565 char __user *uname;
5566 u32 uinfo_len, uname_len, name_len;
5567 int ret = 0;
5568
5569 uinfo = u64_to_user_ptr(attr->info.info);
5570 uinfo_len = attr->info.info_len;
5571
5572 info_copy = min_t(u32, uinfo_len, sizeof(info));
5573 memset(&info, 0, sizeof(info));
5574 if (copy_from_user(&info, uinfo, info_copy))
5575 return -EFAULT;
5576
5577 info.id = btf->id;
5578 ubtf = u64_to_user_ptr(info.btf);
5579 btf_copy = min_t(u32, btf->data_size, info.btf_size);
5580 if (copy_to_user(ubtf, btf->data, btf_copy))
5581 return -EFAULT;
5582 info.btf_size = btf->data_size;
5583
5584 info.kernel_btf = btf->kernel_btf;
5585
5586 uname = u64_to_user_ptr(info.name);
5587 uname_len = info.name_len;
5588 if (!uname ^ !uname_len)
5589 return -EINVAL;
5590
5591 name_len = strlen(btf->name);
5592 info.name_len = name_len;
5593
5594 if (uname) {
5595 if (uname_len >= name_len + 1) {
5596 if (copy_to_user(uname, btf->name, name_len + 1))
5597 return -EFAULT;
5598 } else {
5599 char zero = '\0';
5600
5601 if (copy_to_user(uname, btf->name, uname_len - 1))
5602 return -EFAULT;
> 5603 if (put_user(zero, uname + uname_len - 1))
5604 return -EFAULT;
5605 /* let user-space know about too short buffer */
5606 ret = -ENOSPC;
5607 }
5608 }
5609
5610 if (copy_to_user(uinfo, &info, info_copy) ||
5611 put_user(info_copy, &uattr->info.info_len))
5612 return -EFAULT;
5613
5614 return ret;
5615 }
5616
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27631 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Andrii Nakryiko <andrii@kernel.org>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Alexei Starovoitov <ast@kernel.org>
Subject: [linux-next:master 3828/8750] kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Fri, 27 Nov 2020 19:39:25 +0800 [thread overview]
Message-ID: <202011271922.wHRxAlDP-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4275 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 6147c83fd749d19a0d3ccc2f64d12138ab010b47
commit: 5329722057d41aebc31e391907a501feaa42f7d9 [3828/8750] bpf: Assign ID to vmlinux BTF and return extra info for BTF in GET_OBJ_INFO
config: csky-randconfig-s032-20201127 (attached as .config)
compiler: csky-linux-gcc (GCC) 9.3.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.3-151-g540c2c4b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5329722057d41aebc31e391907a501feaa42f7d9
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 5329722057d41aebc31e391907a501feaa42f7d9
# 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=csky
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 >>)"
kernel/bpf/btf.c:2535:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:2537:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:3314:17: sparse: sparse: Using plain integer as NULL pointer
kernel/bpf/btf.c:3655:9: sparse: sparse: Using plain integer as NULL pointer
>> kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char *__pu_addr @@ got char [noderef] __user * @@
>> kernel/bpf/btf.c:5603:29: sparse: expected char *__pu_addr
>> kernel/bpf/btf.c:5603:29: sparse: got char [noderef] __user *
kernel/bpf/btf.c:5611:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int *__pu_addr @@ got unsigned int [noderef] __user * @@
kernel/bpf/btf.c:5611:13: sparse: expected unsigned int *__pu_addr
kernel/bpf/btf.c:5611:13: sparse: got unsigned int [noderef] __user *
vim +5603 kernel/bpf/btf.c
5556
5557 int btf_get_info_by_fd(const struct btf *btf,
5558 const union bpf_attr *attr,
5559 union bpf_attr __user *uattr)
5560 {
5561 struct bpf_btf_info __user *uinfo;
5562 struct bpf_btf_info info;
5563 u32 info_copy, btf_copy;
5564 void __user *ubtf;
5565 char __user *uname;
5566 u32 uinfo_len, uname_len, name_len;
5567 int ret = 0;
5568
5569 uinfo = u64_to_user_ptr(attr->info.info);
5570 uinfo_len = attr->info.info_len;
5571
5572 info_copy = min_t(u32, uinfo_len, sizeof(info));
5573 memset(&info, 0, sizeof(info));
5574 if (copy_from_user(&info, uinfo, info_copy))
5575 return -EFAULT;
5576
5577 info.id = btf->id;
5578 ubtf = u64_to_user_ptr(info.btf);
5579 btf_copy = min_t(u32, btf->data_size, info.btf_size);
5580 if (copy_to_user(ubtf, btf->data, btf_copy))
5581 return -EFAULT;
5582 info.btf_size = btf->data_size;
5583
5584 info.kernel_btf = btf->kernel_btf;
5585
5586 uname = u64_to_user_ptr(info.name);
5587 uname_len = info.name_len;
5588 if (!uname ^ !uname_len)
5589 return -EINVAL;
5590
5591 name_len = strlen(btf->name);
5592 info.name_len = name_len;
5593
5594 if (uname) {
5595 if (uname_len >= name_len + 1) {
5596 if (copy_to_user(uname, btf->name, name_len + 1))
5597 return -EFAULT;
5598 } else {
5599 char zero = '\0';
5600
5601 if (copy_to_user(uname, btf->name, uname_len - 1))
5602 return -EFAULT;
> 5603 if (put_user(zero, uname + uname_len - 1))
5604 return -EFAULT;
5605 /* let user-space know about too short buffer */
5606 ret = -ENOSPC;
5607 }
5608 }
5609
5610 if (copy_to_user(uinfo, &info, info_copy) ||
5611 put_user(info_copy, &uattr->info.info_len))
5612 return -EFAULT;
5613
5614 return ret;
5615 }
5616
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27631 bytes --]
next reply other threads:[~2020-11-27 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-27 11:39 kernel test robot [this message]
2020-11-27 11:39 ` [linux-next:master 3828/8750] kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces) 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=202011271922.wHRxAlDP-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.