From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 1/6] : bug fix, remove partial zero out
Date: Tue, 19 Jan 2010 15:33:56 +0800 [thread overview]
Message-ID: <4B556064.7080700@cn.fujitsu.com> (raw)
partial-zero-out a struct is very dangerous, we should zero out
field by field directly when need.
partial-zero-out for struct trace_iterator exists when ftrace
was first introduced into mainline kernel. But in this few years,
the code of ftrace is changed a lot, and:
1) partial-zero-out for struct trace_iterator has a bug now,
cpumask_var_t started should not be zeroed out.
2) I viewed the codes and found that fields below
"/* The below is zeroed out in pipe_read */"
don't need to be zeroed out or initialized now.
So, we remove the code of "partial zero out"
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 3ca9485..c6d0e1a 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -54,7 +54,6 @@ struct trace_iterator {
struct ring_buffer_iter *buffer_iter[NR_CPUS];
unsigned long iter_flags;
- /* The below is zeroed out in pipe_read */
struct trace_seq seq;
struct trace_entry *ent;
int leftover;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 5314c90..27fecf8 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3124,12 +3124,6 @@ waitagain:
if (cnt >= PAGE_SIZE)
cnt = PAGE_SIZE - 1;
- /* reset all but tr, trace, and overruns */
- memset(&iter->seq, 0,
- sizeof(struct trace_iterator) -
- offsetof(struct trace_iterator, seq));
- iter->pos = -1;
-
trace_event_read_lock();
trace_access_lock(iter->cpu_file);
while (find_next_entry_inc(iter) != NULL) {
@@ -4398,12 +4392,7 @@ static void __ftrace_dump(bool disable_tracing)
cnt++;
- /* reset all but tr, trace, and overruns */
- memset(&iter.seq, 0,
- sizeof(struct trace_iterator) -
- offsetof(struct trace_iterator, seq));
iter.iter_flags |= TRACE_FILE_LAT_FMT;
- iter.pos = -1;
if (find_next_entry_inc(&iter) != NULL) {
int ret;
next reply other threads:[~2010-01-19 7:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-19 7:33 Lai Jiangshan [this message]
2010-01-20 17:52 ` [PATCH 1/6] : bug fix, remove partial zero out Frederic Weisbecker
2010-01-26 3:31 ` Lai Jiangshan
2010-01-30 21:26 ` Frederic Weisbecker
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=4B556064.7080700@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox