Skip to content

Commit a2ee864

Browse files
herbertpLinus Torvalds
authored andcommitted
[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 <herbert@13thfloor.at> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 6e2ac66 commit a2ee864

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎fs/proc/proc_misc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ static int version_read_proc(char *page, char **start, off_t off,
252252
{
253253
int len;
254254

255-
strcpy(page, linux_banner);
256-
len = strlen(page);
255+
len = sprintf(page, linux_banner,
256+
utsname()->release, utsname()->version);
257257
return proc_calc_metrics(page, start, off, count, eof, len);
258258
}
259259

‎init/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ clean-files := ../include/linux/compile.h
1515

1616
# dependencies on generated files need to be listed explicitly
1717

18+
$(obj)/main.o: include/linux/compile.h
1819
$(obj)/version.o: include/linux/compile.h
1920

2021
# compile.h changes depending on hostname, generation number, etc,

‎init/main.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#include <linux/buffer_head.h>
5151
#include <linux/debug_locks.h>
5252
#include <linux/lockdep.h>
53+
#include <linux/utsrelease.h>
54+
#include <linux/compile.h>
5355

5456
#include <asm/io.h>
5557
#include <asm/bugs.h>
@@ -506,7 +508,7 @@ asmlinkage void __init start_kernel(void)
506508
boot_cpu_init();
507509
page_address_init();
508510
printk(KERN_NOTICE);
509-
printk(linux_banner);
511+
printk(linux_banner, UTS_RELEASE, UTS_VERSION);
510512
setup_arch(&command_line);
511513
unwind_setup();
512514
setup_per_cpu_areas();

‎init/version.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ struct uts_namespace init_uts_ns = {
3535
EXPORT_SYMBOL_GPL(init_uts_ns);
3636

3737
const char linux_banner[] =
38-
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
39-
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
38+
"Linux version %s (" LINUX_COMPILE_BY "@"
39+
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") %s\n";
40+

0 commit comments

Comments
 (0)