netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iwl4965: Enable checking of format strings
@ 2015-02-11 22:51 Rasmus Villemoes
  2015-02-12  0:41 ` Rustad, Mark D
       [not found] ` <1423695069-23436-1-git-send-email-linux-qQsb+v5E8BnlAoU/VqSP6n9LOBIZ5rWg@public.gmane.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Rasmus Villemoes @ 2015-02-11 22:51 UTC (permalink / raw)
  To: Stanislaw Gruszka, Kalle Valo
  Cc: Rasmus Villemoes, linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Since these fmt_* variables are just const char*, and not const
char[], gcc (and smatch) doesn't to type checking of the arguments to
the printf functions. Since the linker knows perfectly well to merge
identical string constants, there's no point in having three static
pointers waste memory and give an extra level of indirection.

This removes over 100 "non-constant format argument" warnings from
smatch, accounting for about 20% of all such warnings in an
allmodconfig.

Signed-off-by: Rasmus Villemoes <linux-qQsb+v5E8BnlAoU/VqSP6n9LOBIZ5rWg@public.gmane.org>
---
 drivers/net/wireless/iwlegacy/4965-debug.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/4965-debug.c b/drivers/net/wireless/iwlegacy/4965-debug.c
index e0597bfdddb8..18855325cc1c 100644
--- a/drivers/net/wireless/iwlegacy/4965-debug.c
+++ b/drivers/net/wireless/iwlegacy/4965-debug.c
@@ -28,10 +28,9 @@
 #include "common.h"
 #include "4965.h"
 
-static const char *fmt_value = "  %-30s %10u\n";
-static const char *fmt_table = "  %-30s %10u  %10u  %10u  %10u\n";
-static const char *fmt_header =
-    "%-32s    current  cumulative       delta         max\n";
+#define fmt_value "  %-30s %10u\n"
+#define fmt_table "  %-30s %10u  %10u  %10u  %10u\n"
+#define fmt_header "%-32s    current  cumulative       delta         max\n"
 
 static int
 il4965_stats_flag(struct il_priv *il, char *buf, int bufsz)
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-28 17:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 22:51 [PATCH] iwl4965: Enable checking of format strings Rasmus Villemoes
2015-02-12  0:41 ` Rustad, Mark D
2015-02-12 10:20   ` Rasmus Villemoes
2015-02-13  7:55     ` Mark Rustad
2015-02-13 10:39       ` Rasmus Villemoes
2015-02-13 11:20         ` David Laight
2015-02-13 12:04           ` Rasmus Villemoes
     [not found] ` <1423695069-23436-1-git-send-email-linux-qQsb+v5E8BnlAoU/VqSP6n9LOBIZ5rWg@public.gmane.org>
2015-04-28 16:19   ` Kalle Valo
2015-04-28 17:49     ` Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).