kernel/trace/trace.h:1338:13: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Tue Feb 14 2023 - 08:18:32 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f6feea56f66d34259c4222fa02e8171c4f2673d1
commit: 93a4fa622eb061f75f87f0cf9609ab4e69c67d01 LoongArch: Add STACKTRACE support
date: 6 months ago
config: loongarch-randconfig-s053-20230214 (https://download.01.org/0day-ci/archive/20230214/202302142132.37Z1iUQa-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=93a4fa622eb061f75f87f0cf9609ab4e69c67d01
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 93a4fa622eb061f75f87f0cf9609ab4e69c67d01
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/media/usb/uvc/ kernel/trace/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302142132.37Z1iUQa-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/trace/trace_events_user.c:280:37: sparse: sparse: Using plain integer as NULL pointer
kernel/trace/trace_events_user.c:461:38: sparse: sparse: Using plain integer as NULL pointer
kernel/trace/trace_events_user.c:482:40: sparse: sparse: Using plain integer as NULL pointer
kernel/trace/trace_events_user.c:1181:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1181:16: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1181:16: sparse: void *
kernel/trace/trace_events_user.c:1248:13: sparse: sparse: cast removes address space '__user' of expression
kernel/trace/trace_events_user.c:1248:13: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __user *buf @@ got char * @@
kernel/trace/trace_events_user.c:1248:13: sparse: expected void [noderef] __user *buf
kernel/trace/trace_events_user.c:1248:13: sparse: got char *
kernel/trace/trace_events_user.c:1264:16: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1264:16: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1264:16: sparse: void *
kernel/trace/trace_events_user.c:1291:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
kernel/trace/trace_events_user.c:1291:9: sparse: void [noderef] __rcu *
kernel/trace/trace_events_user.c:1291:9: sparse: void *
kernel/trace/trace_events_user.c: note: in included file:
>> kernel/trace/trace.h:1338:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct ring_buffer_event *[noderef] __percpu * @@
kernel/trace/trace.h:1338:13: sparse: expected void *ptr
kernel/trace/trace.h:1338:13: sparse: got struct ring_buffer_event *[noderef] __percpu *
>> kernel/trace/trace.h:1338:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct ring_buffer_event *[noderef] __percpu * @@
kernel/trace/trace.h:1338:13: sparse: expected void *ptr
kernel/trace/trace.h:1338:13: sparse: got struct ring_buffer_event *[noderef] __percpu *
>> kernel/trace/trace.h:1338:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct ring_buffer_event *[noderef] __percpu * @@
kernel/trace/trace.h:1338:13: sparse: expected void *ptr
kernel/trace/trace.h:1338:13: sparse: got struct ring_buffer_event *[noderef] __percpu *
>> kernel/trace/trace.h:1338:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct ring_buffer_event *[noderef] __percpu * @@
kernel/trace/trace.h:1338:13: sparse: expected void *ptr
kernel/trace/trace.h:1338:13: sparse: got struct ring_buffer_event *[noderef] __percpu *
--
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got int [noderef] __percpu *
>> drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:165:9: sparse: got int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got unsigned int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got unsigned int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got unsigned int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got unsigned int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got int [noderef] __percpu *
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: expected void *ptr
drivers/media/usb/uvc/uvc_queue.c:184:9: sparse: got int [noderef] __percpu *

vim +1338 kernel/trace/trace.h

0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1333)
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1334) static inline void
13292494379f92 Steven Rostedt (VMware 2019-12-13 1335) __trace_event_discard_commit(struct trace_buffer *buffer,
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1336) struct ring_buffer_event *event)
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1337) {
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 @1338) if (this_cpu_read(trace_buffered_event) == event) {
6c536d76cfe63b Steven Rostedt (VMware 2021-11-29 1339) /* Simply release the temp buffer and enable preemption */
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1340) this_cpu_dec(trace_buffered_event_cnt);
6c536d76cfe63b Steven Rostedt (VMware 2021-11-29 1341) preempt_enable_notrace();
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1342) return;
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1343) }
6c536d76cfe63b Steven Rostedt (VMware 2021-11-29 1344) /* ring_buffer_discard_commit() enables preemption */
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1345) ring_buffer_discard_commit(buffer, event);
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1346) }
0fc1b09ff1ff40 Steven Rostedt (Red Hat 2016-05-03 1347)

:::::: The code at line 1338 was first introduced by commit
:::::: 0fc1b09ff1ff404ddf753f5ffa5cd0adc8fdcdc9 tracing: Use temp buffer when filtering events

:::::: TO: Steven Rostedt (Red Hat) <rostedt@xxxxxxxxxxx>
:::::: CC: Steven Rostedt <rostedt@xxxxxxxxxxx>

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