lkml.org 
[lkml]   [2009]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Kbuild: Disable the -Wformat-security gcc flag
Roland Dreier wrote:
> > Before judging on this patch could you please post what warning it
> > triggers and one or a few patches to fix some of them.
>
> The warnings are things like:
>
> init/main.c: In function 'start_kernel':
> init/main.c:557: warning: format not a string literal and no format arguments
>
> where the patch to fix this would be:
>
> diff --git a/init/main.c b/init/main.c
> index 8442094..78fc0d8 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -554,7 +554,7 @@ asmlinkage void __init start_kernel(void)
> boot_cpu_init();
> page_address_init();
> printk(KERN_NOTICE);
> - printk(linux_banner);
> + printk("%s", linux_banner);
> setup_arch(&command_line);
> mm_init_owner(&init_mm, &init_task);
> setup_command_line(command_line);
>
> with the impact:
>
> add/remove: 0/0 grow/shrink: 1/0 up/down: 7/0 (7)
> function old new delta
> start_kernel 689 696 +7

Just how many of these warnings are showing up? In the cases you posted
it's presumably no problem, but if the string could either a) be
potentially set by a malicious user or b) accidentally contain printk
format characters then this code has a risk that things could blow up..


\
 
 \ /
  Last update: 2009-02-05 00:53    [W:0.065 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site