Skip to contentSkip to conversation

tracing: add printf attribute to log function

PATCH New [email protected] 1 participant 1 message Dec 21, 2020 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: add printf attribute to log function

From: Tom Rix <[email protected]>

Attributing the function allows the compiler to more thoroughly check the use of the function with -Wformat and similar flags.

---
 include/linux/trace.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/trace.h +2 -1
index 886a4ffd9d45..be1e130ed87c 100644
@@ -34,8 +34,9 @@ int unregister_ftrace_export(struct trace_export *export);
 struct trace_array;
 
 void trace_printk_init_buffers(void);
+__printf(3, 4)
 int trace_array_printk(struct trace_array *tr, unsigned long ip,
-		const char *fmt, ...);
+		       const char *fmt, ...);
 int trace_array_init_printk(struct trace_array *tr);
 void trace_array_put(struct trace_array *tr);
 struct trace_array *trace_array_get_by_name(const char *name);
Signature · 1 line
2.27.0