aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/trace.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7d7a07e9b9e9..0aa75be843a0 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4575,20 +4575,33 @@ static size_t
4575tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter) 4575tracing_fill_pipe_page(size_t rem, struct trace_iterator *iter)
4576{ 4576{
4577 size_t count; 4577 size_t count;
4578 int save_len;
4578 int ret; 4579 int ret;
4579 4580
4580 /* Seq buffer is page-sized, exactly what we need. */ 4581 /* Seq buffer is page-sized, exactly what we need. */
4581 for (;;) { 4582 for (;;) {
4582 count = iter->seq.seq.len; 4583 save_len = iter->seq.seq.len;
4583 ret = print_trace_line(iter); 4584 ret = print_trace_line(iter);
4584 count = iter->seq.seq.len - count; 4585
4585 if (rem < count) { 4586 if (trace_seq_has_overflowed(&iter->seq)) {
4586 rem = 0; 4587 iter->seq.seq.len = save_len;
4587 iter->seq.seq.len -= count;
4588 break; 4588 break;
4589 } 4589 }
4590
4591 /*
4592 * This should not be hit, because it should only
4593 * be set if the iter->seq overflowed. But check it
4594 * anyway to be safe.
4595 */
4590 if (ret == TRACE_TYPE_PARTIAL_LINE) { 4596 if (ret == TRACE_TYPE_PARTIAL_LINE) {
4591 iter->seq.seq.len -= count; 4597 iter->seq.seq.len = save_len;
4598 break;
4599 }
4600
4601 count = iter->seq.seq.len - save_len;
4602 if (rem < count) {
4603 rem = 0;
4604 iter->seq.seq.len = save_len;
4592 break; 4605 break;
4593 } 4606 }
4594 4607