[mcgrof-next:20211117-sysctl-cleanups-all-set-04 22/36] kernel/printk/printk.c:3205:2: error: implicit declaration of function 'printk_sysctl_init'

From: kernel test robot
Date: Wed Nov 17 2021 - 23:22:41 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20211117-sysctl-cleanups-all-set-04
head: 3559bb8939dd93c96215ab179d868c5fdc167335
commit: 99f50ec2e9ced923150fa9f7d6d9a5f767cba59c [22/36] printk: move printk sysctl to printk/sysctl.c
config: arm-randconfig-r012-20211118 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c46becf500df2a7fb4b4fce16178a036c344315a)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=99f50ec2e9ced923150fa9f7d6d9a5f767cba59c
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20211117-sysctl-cleanups-all-set-04
git checkout 99f50ec2e9ced923150fa9f7d6d9a5f767cba59c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm

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

All error/warnings (new ones prefixed by >>):

kernel/printk/printk.c:175:5: warning: no previous prototype for function 'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes]
int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
^
kernel/printk/printk.c:175:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
^
static
>> kernel/printk/printk.c:3205:2: error: implicit declaration of function 'printk_sysctl_init' [-Werror,-Wimplicit-function-declaration]
printk_sysctl_init();
^
kernel/printk/printk.c:3205:2: note: did you mean 'printk_late_init'?
kernel/printk/printk.c:3174:19: note: 'printk_late_init' declared here
static int __init printk_late_init(void)
^
1 warning and 1 error generated.
--
>> kernel/printk/sysctl.c:47:13: error: use of undeclared identifier 'printk_delay_msec'
.data = &printk_delay_msec,
^
>> kernel/printk/sysctl.c:59:19: error: use of undeclared identifier 'devkmsg_sysctl_set_loglvl'
.proc_handler = devkmsg_sysctl_set_loglvl,
^
>> kernel/printk/sysctl.c:63:13: error: use of undeclared identifier 'dmesg_restrict'; did you mean 'kptr_restrict'?
.data = &dmesg_restrict,
^~~~~~~~~~~~~~
kptr_restrict
include/linux/printk.h:324:12: note: 'kptr_restrict' declared here
extern int kptr_restrict;
^
>> kernel/printk/sysctl.c:82:13: warning: no previous prototype for function 'printk_sysctl_init' [-Wmissing-prototypes]
void __init printk_sysctl_init(void)
^
kernel/printk/sysctl.c:82:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void __init printk_sysctl_init(void)
^
static
1 warning and 3 errors generated.


vim +/printk_sysctl_init +3205 kernel/printk/printk.c

3159
3160 /*
3161 * Some boot consoles access data that is in the init section and which will
3162 * be discarded after the initcalls have been run. To make sure that no code
3163 * will access this data, unregister the boot consoles in a late initcall.
3164 *
3165 * If for some reason, such as deferred probe or the driver being a loadable
3166 * module, the real console hasn't registered yet at this point, there will
3167 * be a brief interval in which no messages are logged to the console, which
3168 * makes it difficult to diagnose problems that occur during this time.
3169 *
3170 * To mitigate this problem somewhat, only unregister consoles whose memory
3171 * intersects with the init section. Note that all other boot consoles will
3172 * get unregistered when the real preferred console is registered.
3173 */
3174 static int __init printk_late_init(void)
3175 {
3176 struct console *con;
3177 int ret;
3178
3179 for_each_console(con) {
3180 if (!(con->flags & CON_BOOT))
3181 continue;
3182
3183 /* Check addresses that might be used for enabled consoles. */
3184 if (init_section_intersects(con, sizeof(*con)) ||
3185 init_section_contains(con->write, 0) ||
3186 init_section_contains(con->read, 0) ||
3187 init_section_contains(con->device, 0) ||
3188 init_section_contains(con->unblank, 0) ||
3189 init_section_contains(con->data, 0)) {
3190 /*
3191 * Please, consider moving the reported consoles out
3192 * of the init section.
3193 */
3194 pr_warn("bootconsole [%s%d] uses init memory and must be disabled even before the real one is ready\n",
3195 con->name, con->index);
3196 unregister_console(con);
3197 }
3198 }
3199 ret = cpuhp_setup_state_nocalls(CPUHP_PRINTK_DEAD, "printk:dead", NULL,
3200 console_cpu_notify);
3201 WARN_ON(ret < 0);
3202 ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "printk:online",
3203 console_cpu_notify, NULL);
3204 WARN_ON(ret < 0);
> 3205 printk_sysctl_init();
3206 return 0;
3207 }
3208 late_initcall(printk_late_init);
3209

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip