* [linux-next:master 3828/8750] kernel/bpf/btf.c:5603:29: sparse: sparse: incorrect type in initializer (different address spaces)
@ 2020-11-27 11:39 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-11-27 11:39 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: kbuild-all, Linux Memory Management List, Alexei Starovoitov
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-27 11:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).