Skip to contentSkip to conversation

kernel/trace/trace_kprobe.c:810:9: error: call to undeclared function 'find_module'; ISO C99 and later do not support implicit function declarations

PATCH kernel test robot 1 participant 1 message Jul 7, 2024

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace probes/for-next
head:   9d8616034f161222a4ac166c1b42b6d79961c005
commit: 9d8616034f161222a4ac166c1b42b6d79961c005 [16/16] tracing/kprobes: Add symbol counting check when module loads
config: arm-randconfig-004-20240707 (https://download.01.org/0day-ci/archive/20240707/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project a0c6b8aef853eedaa0980f07c0a502a5a8a9740e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240707/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from kernel/trace/trace_kprobe.c:10:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:21:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2253:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]

     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> kernel/trace/trace_kprobe.c:810:9: error: call to undeclared function 'find_module'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     810 |                 mod = find_module(modname);
         |                       ^
   kernel/trace/trace_kprobe.c:810:9: note: did you mean 'init_module'?
   include/linux/module.h:76:12: note: 'init_module' declared here
      76 | extern int init_module(void);
         |            ^
>> kernel/trace/trace_kprobe.c:810:7: error: incompatible integer to pointer conversion assigning to 'struct module *' from 'int' [-Wint-conversion]
     810 |                 mod = find_module(modname);
         |                     ^ ~~~~~~~~~~~~~~~~~~~~

1 warning and 2 errors generated.

vim +/find_module +810 kernel/trace/trace_kprobe.c

796
797 static int validate_probe_symbol(char *symbol)
798 {
799 struct module *mod = NULL;
800 char *modname = NULL, *p;
801 int ret = 0;
802
803 p = strchr(symbol, ':');
804 if (p) {
805 modname = symbol;
806 symbol = p + 1;
807 *p = '\0';
808 /* Return 0 (defer) if the module does not exist yet. */
809 rcu_read_lock_sched();

 > 810			mod = find_module(modname);

811 if (mod && !try_module_get(mod))
812 mod = NULL;
813 rcu_read_unlock_sched();
814 if (!mod)
815 goto out;
816 }
817
818 ret = validate_module_probe_symbol(modname, symbol);
819 out:
820 if (p)
821 *p = ':';
822 if (mod)
823 module_put(mod);
824 return ret;
825 }
826

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki