Commit cc9f59fb authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Steven Rostedt (VMware)

tracing: Avoid -Wformat-nonliteral warning

Building with -Wformat-nonliteral, gcc complains

kernel/trace/trace_output.c: In function ‘seq_print_sym’:
kernel/trace/trace_output.c:356:3: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
   trace_seq_printf(s, fmt, name);

But seq_print_sym only has a single caller which passes "%s" as fmt, so
we might as well just use that directly. That also paves the way for
further cleanups that will actually make that format string go away
entirely.

Link: http://lkml.kernel.org/r/20181029223542.26175-3-linux@rasmusvillemoes.dkSigned-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 59dd974b
...@@ -339,8 +339,7 @@ static inline const char *kretprobed(const char *name) ...@@ -339,8 +339,7 @@ static inline const char *kretprobed(const char *name)
#endif /* CONFIG_KRETPROBES */ #endif /* CONFIG_KRETPROBES */
static void static void
seq_print_sym(struct trace_seq *s, const char *fmt, unsigned long address, seq_print_sym(struct trace_seq *s, unsigned long address, bool offset)
bool offset)
{ {
char str[KSYM_SYMBOL_LEN]; char str[KSYM_SYMBOL_LEN];
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
...@@ -353,12 +352,12 @@ seq_print_sym(struct trace_seq *s, const char *fmt, unsigned long address, ...@@ -353,12 +352,12 @@ seq_print_sym(struct trace_seq *s, const char *fmt, unsigned long address,
name = kretprobed(str); name = kretprobed(str);
if (name && strlen(name)) { if (name && strlen(name)) {
trace_seq_printf(s, fmt, name); trace_seq_printf(s, "%s", name);
return; return;
} }
#endif #endif
snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address); snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address);
trace_seq_printf(s, fmt, str); trace_seq_printf(s, "%s", str);
} }
#ifndef CONFIG_64BIT #ifndef CONFIG_64BIT
...@@ -407,7 +406,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) ...@@ -407,7 +406,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
goto out; goto out;
} }
seq_print_sym(s, "%s", ip, sym_flags & TRACE_ITER_SYM_OFFSET); seq_print_sym(s, ip, sym_flags & TRACE_ITER_SYM_OFFSET);
if (sym_flags & TRACE_ITER_SYM_ADDR) if (sym_flags & TRACE_ITER_SYM_ADDR)
trace_seq_printf(s, " <" IP_FMT ">", ip); trace_seq_printf(s, " <" IP_FMT ">", ip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment