LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Linux Kernel Markers - if check format
@ 2008-02-28  4:54 Mathieu Desnoyers
  2008-02-28  5:22 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2008-02-28  4:54 UTC (permalink / raw)
  To: akpm; +Cc: Jan Kiszka, Frank Ch. Eigler, linux-kernel

Wrap __mark_check_format() into an if(0) to make sure that parameters such as

trace_mark(mm_page_alloc, "order %u pfn %lu", order, page?page_to_pfn(page):0);

(where page_to_pfn() has side-effects) won't generate code because of the
__mark_check_format().

Thanks to Jan Kiszka for reporting this.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Jan Kiszka <jan.kiszka@siemens.com>
CC: "Frank Ch. Eigler" <fche@redhat.com>
---
 include/linux/marker.h |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6-lttng/include/linux/marker.h
===================================================================
--- linux-2.6-lttng.orig/include/linux/marker.h	2008-02-27 11:08:50.000000000 -0500
+++ linux-2.6-lttng/include/linux/marker.h	2008-02-27 11:11:27.000000000 -0500
@@ -104,10 +104,16 @@ static inline void marker_update_probe_r
 #define MARK_NOARGS " "
 
 /* To be used for string format validity checking with gcc */
-static inline void __printf(1, 2) __mark_check_format(const char *fmt, ...)
+static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
 {
 }
 
+#define __mark_check_format(format, args...)				\
+	do {								\
+		if (0)							\
+			___mark_check_format(format, ## args);		\
+	} while (0)
+
 extern marker_probe_func __mark_empty_function;
 
 extern void marker_probe_cb(const struct marker *mdata,

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

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

* Re: [PATCH] Linux Kernel Markers - if check format
  2008-02-28  4:54 [PATCH] Linux Kernel Markers - if check format Mathieu Desnoyers
@ 2008-02-28  5:22 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2008-02-28  5:22 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: Jan Kiszka, Frank Ch. Eigler, linux-kernel

On Wed, 27 Feb 2008 23:54:33 -0500 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:

> Subject: [PATCH] Linux Kernel Markers - if check format

err, that's not very comprehensible.  I changed it to "markers: add an
if(0) to __mark_check_format()".

I think "Linux Kernel Markers" is an excessivelt elaborate subsystem
identifier, btw.   Plain old "markers" will suffice ;)


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

end of thread, other threads:[~2008-02-28  5:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-28  4:54 [PATCH] Linux Kernel Markers - if check format Mathieu Desnoyers
2008-02-28  5:22 ` Andrew Morton

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).