mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
tracing: Use trace_seq_used() and seq_buf_used() instead of len
As the seq_buf->len will soon be +1 size when there's an overflow, we must use trace_seq_used() or seq_buf_used() methods to get the real length. This will prevent buffer overflow issues if just the len of the seq_buf descriptor is used to copy memory. Link: http://lkml.kernel.org/r/20141114121911.09ba3d38@gandalf.local.home Reported-by: Petr Mladek <pmladek@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt
parent
74f06bb723
commit
5ac4837841
@@ -1153,6 +1153,9 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (trace_seq_has_overflowed(s))
|
||||
goto out;
|
||||
|
||||
/* Strip ending newline */
|
||||
if (s->buffer[s->seq.len - 1] == '\n') {
|
||||
s->buffer[s->seq.len - 1] = '\0';
|
||||
@@ -1160,7 +1163,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
|
||||
}
|
||||
|
||||
trace_seq_puts(s, " */\n");
|
||||
|
||||
out:
|
||||
return trace_handle_return(s);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user