From: Herbert Poetzl Date: Fri, 8 Dec 2006 10:36:00 +0000 (-0800) Subject: [PATCH] Fix linux banner utsname information X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2ee8649ba6d71416712e798276bf7c40b64e6e5;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [PATCH] Fix linux banner utsname information utsname information is shown in the linux banner, which also is used for /proc/version (which can have different utsname values inside a uts namespaces). this patch makes the varying data arguments and changes the string to a format string, using those arguments. Signed-off-by: Herbert Poetzl Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 51815cece6f3..9397ff62553e 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -252,8 +252,8 @@ static int version_read_proc(char *page, char **start, off_t off, { int len; - strcpy(page, linux_banner); - len = strlen(page); + len = sprintf(page, linux_banner, + utsname()->release, utsname()->version); return proc_calc_metrics(page, start, off, count, eof, len); } diff --git a/init/Makefile b/init/Makefile index 633a268d270d..d6c764d0eabb 100644 --- a/init/Makefile +++ b/init/Makefile @@ -15,6 +15,7 @@ clean-files := ../include/linux/compile.h # dependencies on generated files need to be listed explicitly +$(obj)/main.o: include/linux/compile.h $(obj)/version.o: include/linux/compile.h # compile.h changes depending on hostname, generation number, etc, diff --git a/init/main.c b/init/main.c index 1174ae3aec8c..4cdcd06e6d78 100644 --- a/init/main.c +++ b/init/main.c @@ -50,6 +50,8 @@ #include #include #include +#include +#include #include #include @@ -506,7 +508,7 @@ asmlinkage void __init start_kernel(void) boot_cpu_init(); page_address_init(); printk(KERN_NOTICE); - printk(linux_banner); + printk(linux_banner, UTS_RELEASE, UTS_VERSION); setup_arch(&command_line); unwind_setup(); setup_per_cpu_areas(); diff --git a/init/version.c b/init/version.c index 8f28344d9c70..2a5dfcd1c2e6 100644 --- a/init/version.c +++ b/init/version.c @@ -35,5 +35,6 @@ struct uts_namespace init_uts_ns = { EXPORT_SYMBOL_GPL(init_uts_ns); const char linux_banner[] = - "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" - LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n"; + "Linux version %s (" LINUX_COMPILE_BY "@" + LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") %s\n"; +