tracing: Fix some checker warnings
authorDavid Howells <dhowells@redhat.com>
Mon, 5 Dec 2022 10:21:52 +0000 (10:21 +0000)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 10 Dec 2022 18:36:05 +0000 (13:36 -0500)
Fix some checker warnings in the trace code by adding __printf attributes
to a number of trace functions and their declarations.

Changes:
========
ver #2)
 - Dropped the fix for the unconditional tracing_max_lat_fops decl[1].

Link: https://lore.kernel.org/r/20221205180617.9b9d3971cbe06ee536603523@kernel.org/
Link: https://lore.kernel.org/r/166992525941.1716618.13740663757583361463.stgit@warthog.procyon.org.uk/
Link: https://lkml.kernel.org/r/167023571258.382307.15314866482834835192.stgit@warthog.procyon.org.uk
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
include/linux/trace_events.h
include/linux/trace_seq.h
kernel/trace/trace.h
kernel/trace/trace_output.c

index bb2053246d6a2e8fdd1a754807b91d60e1c88b12..4342e996bcdb76d985391eebc1b5a2817acd5fc5 100644 (file)
@@ -234,7 +234,8 @@ void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
 void tracing_record_cmdline(struct task_struct *task);
 void tracing_record_tgid(struct task_struct *task);
 
-int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
+int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...)
+        __printf(3, 4);
 
 struct event_filter;
 
index 5a2c650d9e1c10ecd60427448edb6a2425974889..0c4c7587d6c361f1628c4e618bd1caaeae7e592d 100644 (file)
@@ -97,7 +97,8 @@ extern int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str,
                              const void *buf, size_t len, bool ascii);
 
 #else /* CONFIG_TRACING */
-static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
+static inline __printf(2, 3)
+void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
 {
 }
 static inline void
index 9dc920b01c17f15f4fd0c15c455eeaf5e64f9469..e46a49269be2059812836d7b562cc269af2a00ad 100644 (file)
@@ -614,7 +614,7 @@ void trace_buffer_unlock_commit_nostack(struct trace_buffer *buffer,
 bool trace_is_tracepoint_string(const char *str);
 const char *trace_event_format(struct trace_iterator *iter, const char *fmt);
 void trace_check_vprintf(struct trace_iterator *iter, const char *fmt,
-                        va_list ap);
+                        va_list ap) __printf(2, 0);
 
 int trace_empty(struct trace_iterator *iter);
 
index f0ba97121345bf36bd710368b4f8c447caef5f97..57a13b61f18654b12292cb8b7ef24b5caff0f08d 100644 (file)
@@ -322,8 +322,9 @@ void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...)
 }
 EXPORT_SYMBOL(trace_event_printf);
 
-static int trace_output_raw(struct trace_iterator *iter, char *name,
-                           char *fmt, va_list ap)
+static __printf(3, 0)
+int trace_output_raw(struct trace_iterator *iter, char *name,
+                    char *fmt, va_list ap)
 {
        struct trace_seq *s = &iter->seq;