lkml.org 
[lkml]   [2009]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH]: Cleanup: Remove gcc format string warnings when compiling with -Wformat-security
Date
 > Here's the patch that I get when I blindly patch every single location
> that emits this warning.

I would strongly prefer to do this with a little more care. For example
the b43/main.c change:

> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -2005,9 +2005,9 @@ static void b43_print_fw_helptext(struct b43_wl
> *wl, bool error)
> "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
> "and download the latest firmware (version 4).\n";
> if (error)
> - b43err(wl, text);
> + b43err(wl, "%s", text);
> else
> - b43warn(wl, text);
> + b43warn(wl, "%s", text);
> }
would probably be better solved by doing

--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -1999,11 +1999,11 @@ static void b43_release_firmware(struct b43_wldev *dev)

static void b43_print_fw_helptext(struct b43_wl *wl, bool error)
{
- const char *text;
+ static const char text[] =
+ "You must go to "
+ "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
+ "and download the latest firmware (version 4).\n";

- text = "You must go to "
- "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
- "and download the latest firmware (version 4).\n";
if (error)
b43err(wl, text);
else
and in any case I'm not totally convinced that we want to add the bloat
for trivial cases like

char *safe = "foo";
printk(safe);

Would be nice to think of a cleverer way to handle that...

- R.


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