lkml.org 
[lkml]   [2014]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] trace: Replace seq_printf by simpler equivalents
On Wed, 05 Nov 2014 23:44:17 +0100
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:

> On Wed, Nov 05 2014, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > On Fri, 12 Sep 2014 11:25:52 +0200
> > Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> >
> >> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> >> index 5916a8e..7b9ce28 100644
> >> --- a/kernel/trace/ftrace.c
> >> +++ b/kernel/trace/ftrace.c
> >> @@ -556,13 +556,13 @@ static int function_stat_cmp(void *p1, void *p2)
> >> static int function_stat_headers(struct seq_file *m)
> >> {
> >> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> >> - seq_printf(m, " Function "
> >> - "Hit Time Avg s^2\n"
> >> - " -------- "
> >> - "--- ---- --- ---\n");
> >> + seq_puts(m,
> >> + " Function " "Hit Time Avg s^2\n"
> >> + " -------- " "--- ---- --- ---\n");
> >
> > Please keep the original format. I know that it's considered bad form
> > to split strings like this, but I consider this one of the exceptions
> > to the rule.
>
> OK. Want me to resend?

Yeah, can you.


>
> >> @@ -3250,7 +3250,7 @@ static int t_show(struct seq_file *m, void *v)
> >> if (!t)
> >> return 0;
> >>
> >> - seq_printf(m, "%s", t->name);
> >> + seq_puts(m, t->name);
> >
> > This is wrong and dangerous.
> >
> > What happens if "t->name" contains "%d" or "%s"?
>
> Then those characters will be printed to the seq_file, just as they
> would previously? puts doesn't interpret its string argument in any
> way...
>
> >> --- a/kernel/trace/trace_events_trigger.c
> >> +++ b/kernel/trace/trace_events_trigger.c
> >> @@ -373,7 +373,7 @@ event_trigger_print(const char *name, struct seq_file *m,
> >> {
> >> long count = (long)data;
> >>
> >> - seq_printf(m, "%s", name);
> >> + seq_puts(m, name);
> >
> > Again, this is wrong and dangerous.
>
> I'm pretty sure it's neither :-)

Ah you're correct. I was thinking of it as a printf and not a puts.

Never mind ;-) /me needs to work on only 3 different projects at once,
not 4. :-p

-- Steve



\
 
 \ /
  Last update: 2014-11-06 01:41    [W:3.208 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site