From: kernel test robot <lkp@intel.com>
To: Beau Belgrave <beaub@linux.microsoft.com>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [linux-next:master 4567/12845] kernel/trace/trace_events_user.c:424:22: warning: Pointer addition with NULL pointer. [nullPointerArithmetic]
Date: Wed, 16 Mar 2022 23:53:27 +0800 [thread overview]
Message-ID: <202203162336.PhtWQnJn-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: a32cd981a6da2373c093d471ee4405a915e217d5
commit: aa3b2b4c669205200615dd8a2cc4af4f81fd0335 [4567/12845] user_events: Add print_fmt generation support for basic types
compiler: arc-elf-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> kernel/trace/trace_events_user.c:424:22: warning: Pointer addition with NULL pointer. [nullPointerArithmetic]
pos += snprintf(buf + pos, LEN_OR_ZERO, """);
^
kernel/trace/trace_events_user.c:456:39: note: Calling function 'user_event_set_print_fmt', 2nd argument 'NULL' value is 0
len = user_event_set_print_fmt(user, NULL, 0);
^
kernel/trace/trace_events_user.c:424:22: note: Null pointer addition
pos += snprintf(buf + pos, LEN_OR_ZERO, """);
^
kernel/trace/trace_events_user.c:436:22: warning: Pointer addition with NULL pointer. [nullPointerArithmetic]
pos += snprintf(buf + pos, LEN_OR_ZERO, """);
^
kernel/trace/trace_events_user.c:456:39: note: Calling function 'user_event_set_print_fmt', 2nd argument 'NULL' value is 0
len = user_event_set_print_fmt(user, NULL, 0);
^
kernel/trace/trace_events_user.c:436:22: note: Null pointer addition
pos += snprintf(buf + pos, LEN_OR_ZERO, """);
^
vim +424 kernel/trace/trace_events_user.c
415
416 #define LEN_OR_ZERO (len ? len - pos : 0)
417 static int user_event_set_print_fmt(struct user_event *user, char *buf, int len)
418 {
419 struct ftrace_event_field *field, *next;
420 struct list_head *head = &user->fields;
421 int pos = 0, depth = 0;
422 const char *str_func;
423
> 424 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"");
425
426 list_for_each_entry_safe_reverse(field, next, head, link) {
427 if (depth != 0)
428 pos += snprintf(buf + pos, LEN_OR_ZERO, " ");
429
430 pos += snprintf(buf + pos, LEN_OR_ZERO, "%s=%s",
431 field->name, user_field_format(field->type));
432
433 depth++;
434 }
435
436 pos += snprintf(buf + pos, LEN_OR_ZERO, "\"");
437
438 list_for_each_entry_safe_reverse(field, next, head, link) {
439 if (user_field_is_dyn_string(field->type, &str_func))
440 pos += snprintf(buf + pos, LEN_OR_ZERO,
441 ", %s(%s)", str_func, field->name);
442 else
443 pos += snprintf(buf + pos, LEN_OR_ZERO,
444 ", REC->%s", field->name);
445 }
446
447 return pos + 1;
448 }
449 #undef LEN_OR_ZERO
450
---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2022-03-16 15:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202203162336.PhtWQnJn-lkp@intel.com \
--to=lkp@intel.com \
--cc=beaub@linux.microsoft.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.org \
--cc=rostedt@goodmis.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