[coreboot] r3872 - trunk/coreboot-v2/src/include/console

svn at coreboot.org svn at coreboot.org
Tue Jan 20 19:37:26 CET 2009

Author: hailfinger
Date: 2009-01-20 19:37:26 +0100 (Tue, 20 Jan 2009)
New Revision: 3872

Check the printk format string against the matching arguments. We have
this type of checking in the v3 code since ages, but v2 will happily
compile any code with bogus printk format strings and/or parameters.
This can cause real bugs and at least needs to emit a warning, if not
error. Go with a warning for now since most of the flagged format
strings are wrong but harmless in a 32-bit x86 environment.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

Modified: trunk/coreboot-v2/src/include/console/console.h
--- trunk/coreboot-v2/src/include/console/console.h	2009-01-19 21:34:41 UTC (rev 3871)
+++ trunk/coreboot-v2/src/include/console/console.h	2009-01-20 18:37:26 UTC (rev 3872)
@@ -27,7 +27,7 @@
 extern struct console_driver econsole_drivers[];
 extern int console_loglevel;
-int do_printk(int msg_level, const char *fmt, ...);
+int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
 #define printk_emerg(fmt, arg...)   do_printk(BIOS_EMERG   ,fmt, ##arg)
 #define printk_alert(fmt, arg...)   do_printk(BIOS_ALERT   ,fmt, ##arg)

More information about the coreboot mailing list