From 74e5506eb48cdb99aef6f3498a82aecb165ad9f4 Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Thu, 12 Sep 2019 17:27:40 +0900 Subject: [PATCH 1/6] lkl: fix a string format warning String format %p family expects to be passed void * type. This commit adds missing explicit type cast. Signed-off-by: Akira Moroo --- arch/lkl/kernel/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/lkl/kernel/misc.c b/arch/lkl/kernel/misc.c index b9abc26879d576..fa6a1b665beca7 100644 --- a/arch/lkl/kernel/misc.c +++ b/arch/lkl/kernel/misc.c @@ -15,7 +15,8 @@ void dump_stack(void) while (((long)stack & (THREAD_SIZE - 1)) != 0) { addr = *stack; if (__kernel_text_address(addr)) { - pr_info("%p: [<%08lx>] %pS", stack, addr, addr); + pr_info("%p: [<%08lx>] %pS", stack, addr, + (void *)addr); pr_cont("\n"); } stack++; From d770bfb86f4a30c27e1bba6bbf614738e4bd7745 Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Thu, 12 Sep 2019 17:25:34 +0900 Subject: [PATCH 2/6] lkl: add missing bitsperlong header include arch/lkl/include/uapi/asm/unistd.h refers __BITS_PER_LONG defined in arch/lkl/include/asm/bitsperlong.h. This header file should be included in unistd.h. Signed-off-by: Akira Moroo --- arch/lkl/include/uapi/asm/unistd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/lkl/include/uapi/asm/unistd.h b/arch/lkl/include/uapi/asm/unistd.h index 206d8c5194a833..b30064b1e1857d 100644 --- a/arch/lkl/include/uapi/asm/unistd.h +++ b/arch/lkl/include/uapi/asm/unistd.h @@ -6,6 +6,8 @@ #define __ARCH_WANT_SET_GET_RLIMIT #define __ARCH_WANT_TIME32_SYSCALLS +#include + #if __BITS_PER_LONG == 64 #define __ARCH_WANT_SYS_NEWFSTATAT #endif From d964547cb5e1b6badaca65abce8f99390b869faf Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Thu, 12 Sep 2019 14:04:54 +0900 Subject: [PATCH 3/6] lkl: replace strncpy with strscpy According to Documentation/process/deprecated.rst, strncpy should be replaced with strscpy. Signed-off-by: Akira Moroo --- arch/lkl/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/lkl/kernel/setup.c b/arch/lkl/kernel/setup.c index 209d8df1c32d85..0d6482b5518d48 100644 --- a/arch/lkl/kernel/setup.c +++ b/arch/lkl/kernel/setup.c @@ -61,7 +61,7 @@ int __init lkl_start_kernel(struct lkl_host_operations *ops, va_end(ap); if (ops->virtio_devices) - strncpy(boot_command_line + ret, ops->virtio_devices, + strscpy(boot_command_line + ret, ops->virtio_devices, COMMAND_LINE_SIZE - ret); memcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); From 4674f04f3daa3391ce44a66d73975a838cc0d4e3 Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Thu, 12 Sep 2019 19:10:42 +0900 Subject: [PATCH 4/6] lkl: hide dump_stack() if CONFIG_PRINTK is not set include/linux/printk.h defines stub dump_stack() if CONFIG_PRINTK is not set. This function conflicts with dump_stack() in arch/lkl/kernel/misc.c. This commit resolves the issue by hiding lkl specific dump_stack() if CONFIG_PRINTK is not set. Signed-off-by: Akira Moroo --- arch/lkl/kernel/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/lkl/kernel/misc.c b/arch/lkl/kernel/misc.c index fa6a1b665beca7..a60076068748ba 100644 --- a/arch/lkl/kernel/misc.c +++ b/arch/lkl/kernel/misc.c @@ -5,6 +5,7 @@ #include #include +#ifdef CONFIG_PRINTK void dump_stack(void) { unsigned long dummy; @@ -23,6 +24,7 @@ void dump_stack(void) } pr_info("\n"); } +#endif void show_regs(struct pt_regs *regs) { From 06a89e509a00802629f3fcb3a20430673533d76f Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Fri, 27 Sep 2019 23:07:17 +0900 Subject: [PATCH 5/6] lkl: remove redundant generic-y page.h Kbuild reports that page.h is redundant. This commit removes it. Signed-off-by: Akira Moroo --- arch/lkl/include/asm/Kbuild | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/lkl/include/asm/Kbuild b/arch/lkl/include/asm/Kbuild index 56d5d8f39a5d92..f6308985c61c9e 100644 --- a/arch/lkl/include/asm/Kbuild +++ b/arch/lkl/include/asm/Kbuild @@ -40,7 +40,6 @@ generic-y += mmu.h generic-y += mmu_context.h generic-y += module.h generic-y += msgbuf.h -generic-y += page.h generic-y += param.h generic-y += parport.h generic-y += pci.h From fd54f45c8e30cf8c28b7b03333e5950560bdd68a Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Fri, 27 Sep 2019 23:13:55 +0900 Subject: [PATCH 6/6] lkl tools: fix inet_pton declaration gcc reports an implicit declaration warning about inet_pton function. This commit fixes the issue by including or defining it. Signed-off-by: Akira Moroo --- tools/lkl/lib/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/lkl/lib/config.c b/tools/lkl/lib/config.c index 8e2d8fda574b05..745d9959b7547f 100644 --- a/tools/lkl/lib/config.c +++ b/tools/lkl/lib/config.c @@ -1,6 +1,11 @@ #include #define _HAVE_STRING_ARCH_strtok_r #include +#ifndef __MINGW32__ +#include +#else +#define inet_pton lkl_inet_pton +#endif #include #include