From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] trace: Replace seq_printf by simpler equivalents
Date: Wed, 05 Nov 2014 23:44:17 +0100 [thread overview]
Message-ID: <87tx2de08u.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <20141105173454.7aa47289@gandalf.local.home> (Steven Rostedt's message of "Wed, 5 Nov 2014 17:34:54 -0500")
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?
>> @@ -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 :-)
Rasmus
next prev parent reply other threads:[~2014-11-05 22:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-12 9:25 [PATCH 0/6] Small seqfile-use improvements Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 1/6] Coccinelle: Semantic patch for replacing puts with putc Rasmus Villemoes
2014-09-12 11:08 ` [Cocci] " SF Markus Elfring
2014-09-12 11:08 ` SF Markus Elfring
2014-09-12 11:08 ` SF Markus Elfring
2014-09-12 9:25 ` [PATCH 2/6] Coccinelle: Semantic patch for joining seq_puts calls Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 3/6] Coccinelle: Semantic patch for replacing seq_printf calls with equivalent but simpler functions Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 4/6] trace: Replace seq_printf by simpler equivalents Rasmus Villemoes
2014-11-05 22:34 ` Steven Rostedt
2014-11-05 22:44 ` Rasmus Villemoes [this message]
2014-11-06 0:34 ` Steven Rostedt
2014-11-05 22:51 ` Joe Perches
2014-11-06 0:38 ` Steven Rostedt
2014-11-06 0:47 ` Joe Perches
2014-11-08 20:42 ` [PATCH v2 0/3] trace: Use simpler seq_file functions Rasmus Villemoes
2014-11-08 20:42 ` [PATCH v2 1/3] trace: Replace seq_printf by simpler equivalents Rasmus Villemoes
2014-11-14 2:31 ` Steven Rostedt
2014-11-08 20:42 ` [PATCH v2 2/3] trace: Merge consecutive seq_puts calls Rasmus Villemoes
2014-11-08 20:42 ` [PATCH v2 3/3] trace: Replace single-character seq_puts with seq_putc Rasmus Villemoes
2014-11-14 2:34 ` Steven Rostedt
2014-09-12 9:25 ` [PATCH 5/6] trace: Merge consecutive seq_puts calls Rasmus Villemoes
2014-09-12 9:25 ` [PATCH 6/6] trace: Replace single-character seq_puts with seq_putc Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tx2de08u.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=Julia.Lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.