Commit ff078d8f authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by Steven Rostedt

tracing: Use seq_buf_used() in seq_buf_to_user() instead of len

commit 5ac48378 ("tracing: Use trace_seq_used() and seq_buf_used()
instead of len") changed the tracing code to use trace_seq_used() and
seq_buf_used() instead of using the seq_buf len directly to avoid
overflow issues, but missed a spot in seq_buf_to_user() that makes use
of s->len.

Cleaned up the code a bit as well per suggestion of Steve Rostedt.

Link: default avatarJerry Snitselaar <>
Signed-off-by: default avatarSteven Rostedt <>
parent 27dff4e0
......@@ -306,10 +306,12 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, int cnt)
if (!cnt)
return 0;
if (s->len <= s->readpos)
len = seq_buf_used(s);
if (len <= s->readpos)
return -EBUSY;
len = seq_buf_used(s) - s->readpos;
len -= s->readpos;
if (cnt > len)
cnt = len;
ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment