From: kernel test robot <lkp@intel.com>
To: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Tom Zanussi <zanussi@kernel.org>
Subject: kernel/trace/trace_events_synth.c:436:68: sparse: sparse: incorrect type in argument 2 (different address spaces)
Date: Wed, 1 Nov 2023 00:47:16 +0800 [thread overview]
Message-ID: <202311010013.fm8WTxa5-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5a6a09e97199d6600d31383055f9d43fbbcbe86f
commit: 0934ae9977c27133449b6dd8c6213970e7eece38 tracing: Fix reading strings from synthetic events
date: 1 year, 1 month ago
config: x86_64-randconfig-x014-20230805 (https://download.01.org/0day-ci/archive/20231101/202311010013.fm8WTxa5-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/202311010013.fm8WTxa5-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311010013.fm8WTxa5-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> kernel/trace/trace_events_synth.c:436: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:436:68: sparse: expected void const [noderef] __user *unsafe_addr
kernel/trace/trace_events_synth.c:436:68: sparse: got char *str_val
vim +436 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((unsigned long)str_val);
424
425 data_offset |= len << 16;
426 *(u32 *)&entry->fields[*n_u64] = data_offset;
427
428 ret = kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry);
429
430 (*n_u64)++;
431 } else {
432 str_field = (char *)&entry->fields[*n_u64];
433
434 #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
435 if ((unsigned long)str_val < TASK_SIZE)
> 436 ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX);
437 else
438 #endif
439 ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX);
440
441 if (ret < 0)
442 strcpy(str_field, FAULT_STRING);
443
444 (*n_u64) += STR_VAR_LEN_MAX / sizeof(u64);
445 }
446
447 return len;
448 }
449
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-10-31 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-31 16:47 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-10-19 3:43 kernel/trace/trace_events_synth.c:436:68: sparse: sparse: incorrect type in argument 2 (different address spaces) kernel test robot
2022-10-19 13:34 ` Steven Rostedt
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=202311010013.fm8WTxa5-lkp@intel.com \
--to=lkp@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=zanussi@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox