Skip to content

Commit

Permalink
markers: add an if(0) to __mark_check_format()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mathieu Desnoyers authored and Linus Torvalds committed Mar 5, 2008
1 parent 544adb4 commit acc4988
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/linux/marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,16 @@ static inline void marker_update_probe_range(struct marker *begin,
#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,
Expand Down

0 comments on commit acc4988

Please sign in to comment.