From: Steven Rostedt <rostedt@goodmis.org>
To: Jerry Snitselaar <jsnitsel@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: use seq_buf_used() in seq_buf_to_user() instead of len
Date: Wed, 23 Dec 2015 11:09:30 -0500 [thread overview]
Message-ID: <20151223110930.27feb3a8@gandalf.local.home> (raw)
In-Reply-To: <1447703848-2951-1-git-send-email-jsnitsel@redhat.com>
On Mon, 16 Nov 2015 12:57:28 -0700
Jerry Snitselaar <jsnitsel@redhat.com> wrote:
> commit 5ac48378414d ("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.
>
> Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
I finally got around to applying this. Thanks!
-- Steve
> ---
> lib/seq_buf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/seq_buf.c b/lib/seq_buf.c
> index 5c94e10..cb18469 100644
> --- a/lib/seq_buf.c
> +++ b/lib/seq_buf.c
> @@ -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);
prev parent reply other threads:[~2015-12-23 16:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-16 19:57 Jerry Snitselaar
2015-12-23 16:09 ` Steven Rostedt [this message]
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=20151223110930.27feb3a8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=jsnitsel@redhat.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®