[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202203281937.Po855SGa-lkp@intel.com>
Date: Mon, 28 Mar 2022 19:14:55 +0800
From: kernel test robot <lkp@...el.com>
To: Beau Belgrave <beaub@...ux.microsoft.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
"Steven Rostedt (Google)" <rostedt@...dmis.org>
Subject: kernel/trace/trace_events_user.c:593:31: sparse: sparse: incorrect
type in assignment (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ae085d7f9365de7da27ab5c0d16b12d51ea7fca9
commit: 0279400ad38d858ed68f5d787385f6122d4170b2 user_events: Optimize writing events by only copying data once
date: 6 weeks ago
config: i386-randconfig-s001-20220328 (https://download.01.org/0day-ci/archive/20220328/202203281937.Po855SGa-lkp@intel.com/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0279400ad38d858ed68f5d787385f6122d4170b2
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0279400ad38d858ed68f5d787385f6122d4170b2
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/acpi/apei/ drivers/gpu/drm/ kernel/trace/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
kernel/trace/trace_events_user.c:409:38: sparse: sparse: Using plain integer as NULL pointer
kernel/trace/trace_events_user.c:430:40: sparse: sparse: Using plain integer as NULL pointer
>> kernel/trace/trace_events_user.c:593:31: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *[assigned] udata @@ got void [noderef] __user * @@
kernel/trace/trace_events_user.c:593:31: sparse: expected void *[assigned] udata
kernel/trace/trace_events_user.c:593:31: sparse: got void [noderef] __user *
kernel/trace/trace_events_user.c:1064:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1064:16: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1064:16: sparse: void *
kernel/trace/trace_events_user.c:1122:13: sparse: sparse: cast removes address space '__user' of expression
kernel/trace/trace_events_user.c:1122:13: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __user *buf @@ got char * @@
kernel/trace/trace_events_user.c:1122:13: sparse: expected void [noderef] __user *buf
kernel/trace/trace_events_user.c:1122:13: sparse: got char *
kernel/trace/trace_events_user.c:1138:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1138:16: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1138:16: sparse: void *
kernel/trace/trace_events_user.c:1165:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1165:9: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1165:9: sparse: void *
vim +593 kernel/trace/trace_events_user.c
571
572 #ifdef CONFIG_PERF_EVENTS
573 static void user_event_bpf(struct user_event *user, struct iov_iter *i)
574 {
575 struct user_bpf_context context;
576 struct user_bpf_iter bpf_i;
577 char fast_data[MAX_STACK_BPF_DATA];
578 void *temp = NULL;
579
580 if ((user->flags & FLAG_BPF_ITER) && iter_is_iovec(i)) {
581 /* Raw iterator */
582 context.data_type = USER_BPF_DATA_ITER;
583 context.data_len = i->count;
584 context.iter = &bpf_i;
585
586 bpf_i.iov_offset = i->iov_offset;
587 bpf_i.iov = i->iov;
588 bpf_i.nr_segs = i->nr_segs;
589 } else if (i->nr_segs == 1 && iter_is_iovec(i)) {
590 /* Single buffer from user */
591 context.data_type = USER_BPF_DATA_USER;
592 context.data_len = i->count;
> 593 context.udata = i->iov->iov_base + i->iov_offset;
594 } else {
595 /* Multi buffer from user */
596 struct iov_iter copy = *i;
597 size_t copy_size = min_t(size_t, i->count, MAX_BPF_COPY_SIZE);
598
599 context.data_type = USER_BPF_DATA_KERNEL;
600 context.kdata = fast_data;
601
602 if (unlikely(copy_size > sizeof(fast_data))) {
603 temp = kmalloc(copy_size, GFP_NOWAIT);
604
605 if (temp)
606 context.kdata = temp;
607 else
608 copy_size = sizeof(fast_data);
609 }
610
611 context.data_len = copy_nofault(context.kdata,
612 copy_size, ©);
613 }
614
615 trace_call_bpf(&user->call, &context);
616
617 kfree(temp);
618 }
619
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists