Skip to content

Commit bfd5a5e

Browse files
dhowellsrostedt
authored andcommitted
tracing: Fix some checker warnings
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/[email protected]/ [1] Link: https://lore.kernel.org/r/166992525941.1716618.13740663757583361463.stgit@warthog.procyon.org.uk/ # v1 Link: https://lkml.kernel.org/r/167023571258.382307.15314866482834835192.stgit@warthog.procyon.org.uk Signed-off-by: David Howells <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ec37089 commit bfd5a5e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

include/linux/trace_events.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ void tracing_record_taskinfo_sched_switch(struct task_struct *prev,
234234
void tracing_record_cmdline(struct task_struct *task);
235235
void tracing_record_tgid(struct task_struct *task);
236236

237-
int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
237+
int trace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...)
238+
__printf(3, 4);
238239

239240
struct event_filter;
240241

include/linux/trace_seq.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ extern int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str,
9797
const void *buf, size_t len, bool ascii);
9898

9999
#else /* CONFIG_TRACING */
100-
static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
100+
static inline __printf(2, 3)
101+
void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
101102
{
102103
}
103104
static inline void

kernel/trace/trace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ void trace_buffer_unlock_commit_nostack(struct trace_buffer *buffer,
614614
bool trace_is_tracepoint_string(const char *str);
615615
const char *trace_event_format(struct trace_iterator *iter, const char *fmt);
616616
void trace_check_vprintf(struct trace_iterator *iter, const char *fmt,
617-
va_list ap);
617+
va_list ap) __printf(2, 0);
618618

619619
int trace_empty(struct trace_iterator *iter);
620620

kernel/trace/trace_output.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...)
322322
}
323323
EXPORT_SYMBOL(trace_event_printf);
324324

325-
static int trace_output_raw(struct trace_iterator *iter, char *name,
326-
char *fmt, va_list ap)
325+
static __printf(3, 0)
326+
int trace_output_raw(struct trace_iterator *iter, char *name,
327+
char *fmt, va_list ap)
327328
{
328329
struct trace_seq *s = &iter->seq;
329330

0 commit comments

Comments
 (0)