Skip to contentSkip to conversation

kernel/trace/trace_kprobe.c:810:21: warning: assignment to 'struct module *' from 'int' makes pointer from integer without a cast

PATCH kernel test robot 2 participants 2 messages Jul 6, 2024 – Jul 8, 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: arc-randconfig-001-20240707 (https://download.01.org/0day-ci/archive/20240707/[email protected]/config)
compiler: arc-elf-gcc (GCC) 13.2.0
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 warnings (new ones prefixed by >>):

kernel/trace/trace_kprobe.c: In function 'validate_probe_symbol':
kernel/trace/trace_kprobe.c:810:23: error: implicit declaration of function 'find_module'; did you mean 'init_module'? [-Werror=implicit-function-declaration]

     810 |                 mod = find_module(modname);
         |                       ^~~~~~~~~~~
         |                       init_module
>> kernel/trace/trace_kprobe.c:810:21: warning: assignment to 'struct module *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     810 |                 mod = find_module(modname);
         |                     ^

cc1: some warnings being treated as errors

vim +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
#1 lore raw
Quoted 15 lines · On Sun, 7 Jul 2024 07:58:29 +0800 kernel test robot <[email protected]> wrote:
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: arc-randconfig-001-20240707 (https://download.01.org/0day-ci/archive/20240707/[email protected]/config)
compiler: arc-elf-gcc (GCC) 13.2.0
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 warnings (new ones prefixed by >>):

kernel/trace/trace_kprobe.c: In function 'validate_probe_symbol':

Quoted 8 lines
   kernel/trace/trace_kprobe.c:810:23: error: implicit declaration of function 'find_module'; did you mean 'init_module'? [-Werror=implicit-function-declaration]
     810 |                 mod = find_module(modname);
         |                       ^~~~~~~~~~~
         |                       init_module
Quoted 1 line
Quoted 1 line

kernel/trace/trace_kprobe.c:810:21: warning: assignment to 'struct module *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

     810 |                 mod = find_module(modname);
         |                     ^

cc1: some warnings being treated as errors

Oops, find_module() is not exposed when CONFIG_MODULES=n...

Let me update it.

Quoted 39 lines

vim +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();
Quoted 1 line

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
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>