From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 8601/10945] kernel/trace/trace_eprobe.c:51:2: warning: Argument to kfree() is a constant address (4294967277), which is not memory allocated by malloc() [clang-analyzer-unix.Malloc]
Date: Sat, 28 Aug 2021 20:21:37 +0800 [thread overview]
Message-ID: <202108282033.dHnAz1G3-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 45925 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
CC: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 5e63226c72287bc6c6724d4fc7e157af0e3d7908
commit: 7491e2c442781a1860181adb5ab472a52075f393 [8601/10945] tracing: Add a probe that attaches to trace events
:::::: branch date: 25 hours ago
:::::: commit date: 8 days ago
config: i386-randconfig-c001-20210827 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=7491e2c442781a1860181adb5ab472a52075f393
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 7491e2c442781a1860181adb5ab472a52075f393
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:282:9: note: Left side of '||' is false
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:282:9: note: Left side of '||' is true
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:291:28: note: expanded from macro '__native_word'
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
^
include/linux/list.h:282:9: note: Taking false branch
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
include/linux/list.h:282:9: note: Loop condition is false. Exiting loop
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
include/linux/list.h:282:2: note: Returning zero, which participates in a condition later
return READ_ONCE(head->next) == head;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:467:7: note: Returning from 'list_empty'
if (!list_empty(list))
^~~~~~~~~~~~~~~~
include/linux/list.h:467:2: note: Taking true branch
if (!list_empty(list))
^
include/linux/list.h:468:23: note: Passing null pointer value via 2nd parameter 'prev'
__list_splice(list, head->prev, head);
^~~~~~~~~~
include/linux/list.h:468:3: note: Calling '__list_splice'
__list_splice(list, head->prev, head);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:441:13: note: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'prev')
prev->next = first;
~~~~ ^
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
>> kernel/trace/trace_eprobe.c:51:2: warning: Argument to kfree() is a constant address (4294967277), which is not memory allocated by malloc() [clang-analyzer-unix.Malloc]
kfree(ep);
^
kernel/trace/trace_eprobe.c:817:6: note: Assuming 'argc' is >= 2
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~
kernel/trace/trace_eprobe.c:817:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:817:18: note: Assuming the condition is false
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:817:2: note: Taking false branch
if (argc < 2 || argv[0][0] != 'e')
^
kernel/trace/trace_eprobe.c:823:6: note: Assuming 'event' is non-null
if (event) {
^~~~~
kernel/trace/trace_eprobe.c:823:2: note: Taking true branch
if (event) {
^
kernel/trace/trace_eprobe.c:827:7: note: Assuming 'ret' is 0
if (ret)
^~~
kernel/trace/trace_eprobe.c:827:3: note: Taking false branch
if (ret)
^
kernel/trace/trace_eprobe.c:834:6: note: Left side of '||' is false
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:834:2: note: Taking false branch
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:840:6: note: Assuming 'ret' is 0
if (ret || !sys_name)
^~~
kernel/trace/trace_eprobe.c:840:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:840:13: note: Assuming 'sys_name' is non-null
if (ret || !sys_name)
^~~~~~~~~
kernel/trace/trace_eprobe.c:840:2: note: Taking false branch
if (ret || !sys_name)
^
kernel/trace/trace_eprobe.c:842:6: note: Left side of '||' is false
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^
kernel/trace/trace_eprobe.c:842:2: note: Taking false branch
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^
kernel/trace/trace_eprobe.c:850:2: note: Taking true branch
if (IS_ERR(ep)) {
^
kernel/trace/trace_eprobe.c:853:3: note: Taking true branch
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:78:2: note: expanded from macro '__WARN_FLAGS'
instrumentation_begin(); \
^
include/linux/instrumentation.h:57:34: note: expanded from macro 'instrumentation_begin'
# define instrumentation_begin() do { } while(0)
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:79:2: note: expanded from macro '__WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \
^
arch/x86/include/asm/bug.h:25:37: note: expanded from macro '_BUG_FLAGS'
#define _BUG_FLAGS(ins, flags) \
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:81:2: note: expanded from macro '__WARN_FLAGS'
instrumentation_end(); \
^
include/linux/instrumentation.h:58:33: note: expanded from macro 'instrumentation_end'
# define instrumentation_end() do { } while(0)
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:76:33: note: expanded from macro '__WARN_FLAGS'
#define __WARN_FLAGS(flags) \
^
--
^
kernel/trace/trace_eprobe.c:49:6: note: Assuming field 'event' is null
if (ep->event)
^~~~~~~~~
kernel/trace/trace_eprobe.c:49:2: note: Taking false branch
if (ep->event)
^
kernel/trace/trace_eprobe.c:51:2: note: Argument to kfree() is a constant address (4294967277), which is not memory allocated by malloc()
kfree(ep);
^ ~~
kernel/trace/trace_eprobe.c:51:2: warning: Argument to kfree() is a constant address (4294967284), which is not memory allocated by malloc() [clang-analyzer-unix.Malloc]
kfree(ep);
^
kernel/trace/trace_eprobe.c:817:6: note: Assuming 'argc' is >= 2
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~
kernel/trace/trace_eprobe.c:817:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:817:18: note: Assuming the condition is false
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:817:2: note: Taking false branch
if (argc < 2 || argv[0][0] != 'e')
^
kernel/trace/trace_eprobe.c:823:6: note: Assuming 'event' is non-null
if (event) {
^~~~~
kernel/trace/trace_eprobe.c:823:2: note: Taking true branch
if (event) {
^
kernel/trace/trace_eprobe.c:827:7: note: Assuming 'ret' is 0
if (ret)
^~~
kernel/trace/trace_eprobe.c:827:3: note: Taking false branch
if (ret)
^
kernel/trace/trace_eprobe.c:834:6: note: Left side of '||' is false
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:834:30: note: Assuming the condition is false
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:2: note: Taking false branch
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:840:6: note: Assuming 'ret' is 0
if (ret || !sys_name)
^~~
kernel/trace/trace_eprobe.c:840:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:840:13: note: Assuming 'sys_name' is non-null
if (ret || !sys_name)
^~~~~~~~~
kernel/trace/trace_eprobe.c:840:2: note: Taking false branch
if (ret || !sys_name)
^
kernel/trace/trace_eprobe.c:842:6: note: Assuming the condition is false
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:842:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:842:34: note: Assuming the condition is false
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:842:2: note: Taking false branch
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^
kernel/trace/trace_eprobe.c:850:2: note: Taking true branch
if (IS_ERR(ep)) {
^
kernel/trace/trace_eprobe.c:853:16: note: Assuming the condition is false
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
kernel/trace/trace_eprobe.c:853:3: note: Taking false branch
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
kernel/trace/trace_eprobe.c:854:3: note: Control jumps to line 885
goto error; /* We know ep is not allocated */
^
kernel/trace/trace_eprobe.c:885:2: note: Calling 'trace_event_probe_cleanup'
trace_event_probe_cleanup(ep);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:44:7: note: 'ep' is non-null
if (!ep)
^~
kernel/trace/trace_eprobe.c:44:2: note: Taking false branch
if (!ep)
^
kernel/trace/trace_eprobe.c:49:6: note: Assuming field 'event' is null
if (ep->event)
^~~~~~~~~
kernel/trace/trace_eprobe.c:49:2: note: Taking false branch
if (ep->event)
^
kernel/trace/trace_eprobe.c:51:2: note: Argument to kfree() is a constant address (4294967284), which is not memory allocated by malloc()
kfree(ep);
^ ~~
>> kernel/trace/trace_eprobe.c:154:23: warning: Access to field 'event' results in a dereference of a null pointer (loaded from variable 'ep') [clang-analyzer-core.NullDereference]
trace_event_put_ref(ep->event);
^
kernel/trace/trace_eprobe.c:817:6: note: Assuming 'argc' is >= 2
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~
kernel/trace/trace_eprobe.c:817:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:817:18: note: Assuming the condition is false
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:817:2: note: Taking false branch
if (argc < 2 || argv[0][0] != 'e')
^
kernel/trace/trace_eprobe.c:823:6: note: Assuming 'event' is non-null
if (event) {
^~~~~
kernel/trace/trace_eprobe.c:823:2: note: Taking true branch
if (event) {
^
kernel/trace/trace_eprobe.c:827:7: note: Assuming 'ret' is 0
if (ret)
^~~
kernel/trace/trace_eprobe.c:827:3: note: Taking false branch
if (ret)
^
kernel/trace/trace_eprobe.c:834:7: note: Calling 'is_good_name'
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:6: note: Assuming the condition is false
if (!isalpha(*name) && *name != '_')
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:22: note: Left side of '&&' is false
if (!isalpha(*name) && *name != '_')
^
kernel/trace/trace.h:1924:9: note: Assuming the condition is false
while (*++name != '\0') {
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1924:2: note: Loop condition is false. Execution continues on line 1928
while (*++name != '\0') {
^
kernel/trace/trace.h:1928:2: note: Returning the value 1, which participates in a condition later
return true;
^~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:7: note: Returning from 'is_good_name'
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:6: note: Left side of '||' is false
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:834:31: note: Calling 'is_good_name'
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:6: note: Assuming the condition is false
if (!isalpha(*name) && *name != '_')
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:22: note: Left side of '&&' is false
if (!isalpha(*name) && *name != '_')
^
kernel/trace/trace.h:1924:9: note: Assuming the condition is false
while (*++name != '\0') {
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1924:2: note: Loop condition is false. Execution continues on line 1928
while (*++name != '\0') {
^
kernel/trace/trace.h:1928:2: note: Returning the value 1, which participates in a condition later
return true;
^~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:31: note: Returning from 'is_good_name'
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:2: note: Taking false branch
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:840:6: note: Assuming 'ret' is 0
if (ret || !sys_name)
^~~
kernel/trace/trace_eprobe.c:840:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:840:13: note: Assuming 'sys_name' is non-null
if (ret || !sys_name)
^~~~~~~~~
kernel/trace/trace_eprobe.c:840:2: note: Taking false branch
if (ret || !sys_name)
^
kernel/trace/trace_eprobe.c:842:7: note: Calling 'is_good_name'
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:6: note: Assuming the condition is false
if (!isalpha(*name) && *name != '_')
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1922:22: note: Left side of '&&' is false
if (!isalpha(*name) && *name != '_')
^
kernel/trace/trace.h:1924:9: note: Assuming the condition is false
while (*++name != '\0') {
^~~~~~~~~~~~~~~
kernel/trace/trace.h:1924:2: note: Loop condition is false. Execution continues on line 1928
while (*++name != '\0') {
^
kernel/trace/trace.h:1928:2: note: Returning the value 1, which participates in a condition later
return true;
^~~~~~~~~~~
--
container_of(ptr, type, member)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
kernel/trace/trace_eprobe.c:703:3: note: Taking false branch
list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
^
include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
for (pos = list_first_entry(head, typeof(*pos), member); \
^
include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
list_entry((ptr)->next, type, member)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
kernel/trace/trace_eprobe.c:703:3: note: Loop condition is false. Exiting loop
list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
^
include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
for (pos = list_first_entry(head, typeof(*pos), member); \
^
include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
list_entry((ptr)->next, type, member)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
kernel/trace/trace_eprobe.c:703:3: note: Loop condition is true. Entering loop body
list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
^
include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
for (pos = list_first_entry(head, typeof(*pos), member); \
^
kernel/trace/trace_eprobe.c:704:9: note: Left side of '&&' is false
ep = container_of(pos, struct trace_eprobe, tp);
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
kernel/trace/trace_eprobe.c:704:9: note: Taking false branch
ep = container_of(pos, struct trace_eprobe, tp);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
kernel/trace/trace_eprobe.c:704:9: note: Loop condition is false. Exiting loop
ep = container_of(pos, struct trace_eprobe, tp);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
kernel/trace/trace_eprobe.c:705:23: note: Access to field 'tr' results in a dereference of a null pointer (loaded from variable 'file')
disable_eprobe(ep, file->tr);
^~~~
>> kernel/trace/trace_eprobe.c:886:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
return ret;
^ ~~~
kernel/trace/trace_eprobe.c:817:6: note: Assuming 'argc' is >= 2
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~
kernel/trace/trace_eprobe.c:817:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:817:18: note: Assuming the condition is false
if (argc < 2 || argv[0][0] != 'e')
^~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:817:2: note: Taking false branch
if (argc < 2 || argv[0][0] != 'e')
^
kernel/trace/trace_eprobe.c:823:6: note: Assuming 'event' is non-null
if (event) {
^~~~~
kernel/trace/trace_eprobe.c:823:2: note: Taking true branch
if (event) {
^
kernel/trace/trace_eprobe.c:827:7: note: Assuming 'ret' is 0
if (ret)
^~~
kernel/trace/trace_eprobe.c:827:3: note: Taking false branch
if (ret)
^
kernel/trace/trace_eprobe.c:834:6: note: Left side of '||' is false
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:834:30: note: Assuming the condition is false
if (!is_good_name(event) || !is_good_name(group))
^~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:834:2: note: Taking false branch
if (!is_good_name(event) || !is_good_name(group))
^
kernel/trace/trace_eprobe.c:840:6: note: Assuming 'ret' is 0
if (ret || !sys_name)
^~~
kernel/trace/trace_eprobe.c:840:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:840:13: note: Assuming 'sys_name' is non-null
if (ret || !sys_name)
^~~~~~~~~
kernel/trace/trace_eprobe.c:840:2: note: Taking false branch
if (ret || !sys_name)
^
kernel/trace/trace_eprobe.c:842:6: note: Assuming the condition is false
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:842:6: note: Left side of '||' is false
kernel/trace/trace_eprobe.c:842:34: note: Assuming the condition is false
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_eprobe.c:842:2: note: Taking false branch
if (!is_good_name(sys_event) || !is_good_name(sys_name))
^
kernel/trace/trace_eprobe.c:850:2: note: Taking true branch
if (IS_ERR(ep)) {
^
kernel/trace/trace_eprobe.c:853:16: note: Assuming the condition is true
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
kernel/trace/trace_eprobe.c:853:3: note: Taking true branch
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
if (unlikely(__ret_warn_on)) \
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:78:2: note: expanded from macro '__WARN_FLAGS'
instrumentation_begin(); \
^
include/linux/instrumentation.h:57:34: note: expanded from macro 'instrumentation_begin'
# define instrumentation_begin() do { } while(0)
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:79:2: note: expanded from macro '__WARN_FLAGS'
_BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \
^
arch/x86/include/asm/bug.h:25:37: note: expanded from macro '_BUG_FLAGS'
#define _BUG_FLAGS(ins, flags) \
^
kernel/trace/trace_eprobe.c:853:3: note: Loop condition is false. Exiting loop
WARN_ON_ONCE(ret != -ENOMEM);
^
include/asm-generic/bug.h:106:3: note: expanded from macro 'WARN_ON_ONCE'
__WARN_FLAGS(BUGFLAG_ONCE | \
^
arch/x86/include/asm/bug.h:81:2: note: expanded from macro '__WARN_FLAGS'
instrumentation_end(); \
vim +51 kernel/trace/trace_eprobe.c
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 41)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 42) static void trace_event_probe_cleanup(struct trace_eprobe *ep)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 43) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 44) if (!ep)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 45) return;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 46) trace_probe_cleanup(&ep->tp);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 47) kfree(ep->event_name);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 48) kfree(ep->event_system);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 49) if (ep->event)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 50) trace_event_put_ref(ep->event);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 @51) kfree(ep);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 52) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 53)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 54) static struct trace_eprobe *to_trace_eprobe(struct dyn_event *ev)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 55) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 56) return container_of(ev, struct trace_eprobe, devent);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 57) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 58)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 59) static int eprobe_dyn_event_create(const char *raw_command)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 60) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 61) return trace_probe_create(raw_command, __trace_eprobe_create);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 62) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 63)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 64) static int eprobe_dyn_event_show(struct seq_file *m, struct dyn_event *ev)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 65) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 66) struct trace_eprobe *ep = to_trace_eprobe(ev);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 67) int i;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 68)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 69) seq_printf(m, "e:%s/%s", trace_probe_group_name(&ep->tp),
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 70) trace_probe_name(&ep->tp));
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 71) seq_printf(m, " %s.%s", ep->event_system, ep->event_name);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 72)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 73) for (i = 0; i < ep->tp.nr_args; i++)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 74) seq_printf(m, " %s=%s", ep->tp.args[i].name, ep->tp.args[i].comm);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 75) seq_putc(m, '\n');
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 76)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 77) return 0;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 78) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 79)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 80) static int unregister_trace_eprobe(struct trace_eprobe *ep)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 81) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 82) /* If other probes are on the event, just unregister eprobe */
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 83) if (trace_probe_has_sibling(&ep->tp))
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 84) goto unreg;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 85)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 86) /* Enabled event can not be unregistered */
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 87) if (trace_probe_is_enabled(&ep->tp))
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 88) return -EBUSY;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 89)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 90) /* Will fail if probe is being used by ftrace or perf */
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 91) if (trace_probe_unregister_event_call(&ep->tp))
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 92) return -EBUSY;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 93)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 94) unreg:
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 95) dyn_event_remove(&ep->devent);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 96) trace_probe_unlink(&ep->tp);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 97)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 98) return 0;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 99) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 100)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 101) static int eprobe_dyn_event_release(struct dyn_event *ev)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 102) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 103) struct trace_eprobe *ep = to_trace_eprobe(ev);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 104) int ret = unregister_trace_eprobe(ep);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 105)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 106) if (!ret)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 107) trace_event_probe_cleanup(ep);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 108) return ret;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 109) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 110)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 111) static bool eprobe_dyn_event_is_busy(struct dyn_event *ev)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 112) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 113) struct trace_eprobe *ep = to_trace_eprobe(ev);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 114)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 115) return trace_probe_is_enabled(&ep->tp);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 116) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 117)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 118) static bool eprobe_dyn_event_match(const char *system, const char *event,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 119) int argc, const char **argv, struct dyn_event *ev)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 120) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 121) struct trace_eprobe *ep = to_trace_eprobe(ev);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 122)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 123) return strcmp(trace_probe_name(&ep->tp), event) == 0 &&
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 124) (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) &&
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 125) trace_probe_match_command_args(&ep->tp, argc, argv);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 126) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 127)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 128) static struct dyn_event_operations eprobe_dyn_event_ops = {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 129) .create = eprobe_dyn_event_create,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 130) .show = eprobe_dyn_event_show,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 131) .is_busy = eprobe_dyn_event_is_busy,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 132) .free = eprobe_dyn_event_release,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 133) .match = eprobe_dyn_event_match,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 134) };
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 135)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 136) static struct trace_eprobe *alloc_event_probe(const char *group,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 137) const char *this_event,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 138) struct trace_event_call *event,
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 139) int nargs)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 140) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 141) struct trace_eprobe *ep;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 142) const char *event_name;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 143) const char *sys_name;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 144) int ret = -ENOMEM;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 145)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 146) if (!event)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 147) return ERR_PTR(-ENODEV);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 148)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 149) sys_name = event->class->system;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 150) event_name = trace_event_name(event);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 151)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 152) ep = kzalloc(struct_size(ep, tp.args, nargs), GFP_KERNEL);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 153) if (!ep) {
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 @154) trace_event_put_ref(ep->event);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 155) goto error;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 156) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 157) ep->event = event;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 158) ep->event_name = kstrdup(event_name, GFP_KERNEL);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 159) if (!ep->event_name)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 160) goto error;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 161) ep->event_system = kstrdup(sys_name, GFP_KERNEL);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 162) if (!ep->event_system)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 163) goto error;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 164)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 165) ret = trace_probe_init(&ep->tp, this_event, group, false);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 166) if (ret < 0)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 167) goto error;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 168)
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 169) dyn_event_init(&ep->devent, &eprobe_dyn_event_ops);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 170) return ep;
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 171) error:
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 172) trace_event_probe_cleanup(ep);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 173) return ERR_PTR(ret);
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 174) }
7491e2c442781a Tzvetomir Stoyanov (VMware 2021-08-19 175)
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29186 bytes --]
reply other threads:[~2021-08-28 12:21 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=202108282033.dHnAz1G3-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.