samples/fprobe/fprobe_example.c:23:15: sparse: sparse: symbol 'sample_probe' was not declared. Should it be static?

From: kernel test robot
Date: Sun Jun 05 2022 - 21:20:12 EST


Hi Stephen,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f2906aa863381afb0015a9eb7fefad885d4e5a56
commit: f3a112c0c40dd96d53c8bdf3ea8d94d528f3b7b8 x86,rethook,kprobes: Replace kretprobe with rethook on x86
date: 10 weeks ago
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20220606/202206060927.LD3CkG2n-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-18-g56afb504-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f3a112c0c40dd96d53c8bdf3ea8d94d528f3b7b8
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f3a112c0c40dd96d53c8bdf3ea8d94d528f3b7b8
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash samples/fprobe/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> samples/fprobe/fprobe_example.c:23:15: sparse: sparse: symbol 'sample_probe' was not declared. Should it be static?

vim +/sample_probe +23 samples/fprobe/fprobe_example.c

6ee64cc3020b5b Masami Hiramatsu 2022-03-15 20
6ee64cc3020b5b Masami Hiramatsu 2022-03-15 21 #define BACKTRACE_DEPTH 16
6ee64cc3020b5b Masami Hiramatsu 2022-03-15 22 #define MAX_SYMBOL_LEN 4096
6ee64cc3020b5b Masami Hiramatsu 2022-03-15 @23 struct fprobe sample_probe;
6ee64cc3020b5b Masami Hiramatsu 2022-03-15 24

:::::: The code at line 23 was first introduced by commit
:::::: 6ee64cc3020b5b5537827c71d8eaac814ad4d346 fprobe: Add sample program for fprobe

:::::: TO: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
:::::: CC: Alexei Starovoitov <ast@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp