[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210121502.6LRS1Fsc-lkp@intel.com>
Date: Wed, 12 Oct 2022 16:09:09 +0800
From: kernel test robot <lkp@...el.com>
To: "Steven Rostedt (Google)" <rostedt@...dmis.org>
Cc: kbuild-all@...ts.01.org, Ammar Faizi <ammarfaizi2@...weeb.org>,
GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
linux-kernel@...r.kernel.org
Subject: [ammarfaizi2-block:rostedt/linux-trace/ftrace/core 46/46]
kernel/trace/trace_events_synth.c:437:68: sparse: sparse: incorrect type in
argument 2 (different address spaces)
tree: https://github.com/ammarfaizi2/linux-block rostedt/linux-trace/ftrace/core
head: 36ac19d408fed20243e0901b038ade4bd6f5c8ad
commit: 36ac19d408fed20243e0901b038ade4bd6f5c8ad [46/46] tracing: Fix reading strings from synthetic events
config: x86_64-randconfig-s022
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/ammarfaizi2/linux-block/commit/36ac19d408fed20243e0901b038ade4bd6f5c8ad
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block rostedt/linux-trace/ftrace/core
git checkout 36ac19d408fed20243e0901b038ade4bd6f5c8ad
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash kernel/trace/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
kernel/trace/trace_events_synth.c:423:47: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got char *str_val @@
kernel/trace/trace_events_synth.c:423:47: sparse: expected unsigned long addr
kernel/trace/trace_events_synth.c:423:47: sparse: got char *str_val
>> kernel/trace/trace_events_synth.c:437:68: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *unsafe_addr @@ got char *str_val @@
kernel/trace/trace_events_synth.c:437:68: sparse: expected void const [noderef] __user *unsafe_addr
kernel/trace/trace_events_synth.c:437:68: sparse: got char *str_val
kernel/trace/trace_events_synth.c:477:47: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got char *[assigned] str_val @@
kernel/trace/trace_events_synth.c:477:47: sparse: expected unsigned long addr
kernel/trace/trace_events_synth.c:477:47: sparse: got char *[assigned] str_val
vim +437 kernel/trace/trace_events_synth.c
404
405 static unsigned int trace_string(struct synth_trace_event *entry,
406 struct synth_event *event,
407 char *str_val,
408 bool is_dynamic,
409 unsigned int data_size,
410 unsigned int *n_u64)
411 {
412 unsigned int len = 0;
413 char *str_field;
414 int ret;
415
416 if (is_dynamic) {
417 u32 data_offset;
418
419 data_offset = offsetof(typeof(*entry), fields);
420 data_offset += event->n_u64 * sizeof(u64);
421 data_offset += data_size;
422
423 len = kern_fetch_store_strlen(str_val) + 1;
424 if (len == 1)
425 len = strlen("fault") + 1;
426 data_offset |= len << 16;
427 *(u32 *)&entry->fields[*n_u64] = data_offset;
428
429 kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry);
430
431 (*n_u64)++;
432 } else {
433 str_field = (char *)&entry->fields[*n_u64];
434
435 #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
436 if ((unsigned long)str_val < TASK_SIZE)
> 437 ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX);
438 else
439 #endif
440 ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX);
441
442 if (ret < 0)
443 strcpy(str_field, "(fault)");
444
445 (*n_u64) += STR_VAR_LEN_MAX / sizeof(u64);
446 }
447
448 return len;
449 }
450
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (131029 bytes)
Powered by blists - more mailing lists