public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Floris Kraak <randakar@gmail.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Trivial Patch Monkey <trivial@kernel.org>
Subject: Re: [PATCH] Kbuild: Disable the -Wformat-security gcc flag
Date: Wed, 04 Feb 2009 14:26:45 -0800	[thread overview]
Message-ID: <adavdrplty2.fsf@cisco.com> (raw)
In-Reply-To: <20090204221451.GA27254@uranus.ravnborg.org> (Sam Ravnborg's message of "Wed, 4 Feb 2009 23:14:51 +0100")

 > 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


There are also many warnings like:

    drivers/char/mem.c: In function 'chr_dev_init':
    drivers/char/mem.c:994: warning: format not a string literal and no format arguments

which require a similar fix but show that we can't just restrict things
to some trick with printk():

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 3586b3b..ba3bf43 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -991,7 +991,7 @@ static int __init chr_dev_init(void)
 	for (i = 0; i < ARRAY_SIZE(devlist); i++)
 		device_create(mem_class, NULL,
 			      MKDEV(MEM_MAJOR, devlist[i].minor), NULL,
-			      devlist[i].name);
+			      "%s", devlist[i].name);
 
 	return 0;
 }

  reply	other threads:[~2009-02-04 22:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-04 14:28 [PATCH] Kbuild: Disable the -Wformat-security gcc flag Floris Kraak
2009-02-04 22:14 ` Sam Ravnborg
2009-02-04 22:26   ` Roland Dreier [this message]
2009-02-04 23:48     ` Robert Hancock
2009-02-05  6:37       ` Roland Dreier
2009-02-05  8:26         ` Floris Kraak
2009-02-05 10:15           ` Floris Kraak
2009-02-05 10:27             ` Andreas Schwab
2009-02-05 10:50               ` Floris Kraak
2009-02-05 21:52               ` Roland Dreier
2009-02-10 21:11           ` Kyle Moffett
2009-02-10 21:56             ` Floris Kraak
2009-02-10 20:24     ` Pavel Machek
2009-02-10 21:48       ` Floris Kraak
2009-05-15 10:23 ` Pekka Enberg
2009-05-15 13:28   ` Floris Kraak
2009-05-15 20:42     ` Pekka Enberg
2009-05-15 22:09       ` Floris Kraak
2009-06-14 20:50     ` Sam Ravnborg
2009-06-15  5:54       ` Pekka J Enberg
2009-06-15  8:02         ` Floris Kraak
2009-06-26 22:15         ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adavdrplty2.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randakar@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox