Re: [PATCH 0/2] vsprintf: ignore %n again

From: Dan Carpenter
Date: Wed Sep 18 2013 - 10:11:40 EST


Sure. There are a lot of non-const strings though.

diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a78..317587b 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -122,6 +122,11 @@ asmlinkage int printk_emit(int facility, int level,

asmlinkage __printf(1, 2) __cold
int printk(const char *fmt, ...);
+#define printk(fmt, ...) do { \
+ compiletime_assert(__builtin_constant_p(fmt), \
+ "Non-constant format string"); \
+ printk(fmt, ##__VA_ARGS__); \
+} while (0)

/*
* Special printk facility for scheduler use only, _DO_NOT_USE_ !
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/