diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-03-24 04:05:27 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-31 11:27:18 -0400 |
commit | eb08f8eb0673d9c1e62b69ad1b41593e73c40467 (patch) | |
tree | 8243201d6f98e5e502fd0688c632e9650c1f973d | |
parent | 5554720482a631702146a959db22fe417740e0a6 (diff) |
blktrace: fix off-by-one bug
'what' is used as the index of array what2act, so it can't >= the array size.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/blktrace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index a7f7ff5db38b..d43cdac7c754 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1152,7 +1152,7 @@ static enum print_line_t blk_trace_event_print(struct trace_iterator *iter, | |||
1152 | if (!trace_print_context(iter)) | 1152 | if (!trace_print_context(iter)) |
1153 | return TRACE_TYPE_PARTIAL_LINE; | 1153 | return TRACE_TYPE_PARTIAL_LINE; |
1154 | 1154 | ||
1155 | if (unlikely(what == 0 || what > ARRAY_SIZE(what2act))) | 1155 | if (unlikely(what == 0 || what >= ARRAY_SIZE(what2act))) |
1156 | ret = trace_seq_printf(s, "Bad pc action %x\n", what); | 1156 | ret = trace_seq_printf(s, "Bad pc action %x\n", what); |
1157 | else { | 1157 | else { |
1158 | const bool long_act = !!(trace_flags & TRACE_ITER_VERBOSE); | 1158 | const bool long_act = !!(trace_flags & TRACE_ITER_VERBOSE); |
@@ -1199,7 +1199,7 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) | |||
1199 | t = (const struct blk_io_trace *)iter->ent; | 1199 | t = (const struct blk_io_trace *)iter->ent; |
1200 | what = t->action & ((1 << BLK_TC_SHIFT) - 1); | 1200 | what = t->action & ((1 << BLK_TC_SHIFT) - 1); |
1201 | 1201 | ||
1202 | if (unlikely(what == 0 || what > ARRAY_SIZE(what2act))) | 1202 | if (unlikely(what == 0 || what >= ARRAY_SIZE(what2act))) |
1203 | ret = trace_seq_printf(&iter->seq, "Bad pc action %x\n", what); | 1203 | ret = trace_seq_printf(&iter->seq, "Bad pc action %x\n", what); |
1204 | else { | 1204 | else { |
1205 | const bool long_act = !!(trace_flags & TRACE_ITER_VERBOSE); | 1205 | const bool long_act = !!(trace_flags & TRACE_ITER_VERBOSE); |