linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] tracing: Simplify the max length test when using the filtering temp buffer
Date: Wed, 9 Jun 2021 18:36:53 -0400	[thread overview]
Message-ID: <20210609183653.0b77510c@rorschach.local.home> (raw)
In-Reply-To: <CAHk-=wj3S_DxdQkXVaQKcUBCyjiYHC3KqPBTMY151rvZzqKVFQ@mail.gmail.com>

On Wed, 9 Jun 2021 15:21:52 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Wed, Jun 9, 2021 at 3:05 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> >                 val = this_cpu_inc_return(trace_buffered_event_cnt);
> > -               if ((len < (PAGE_SIZE - sizeof(*entry) - sizeof(entry->array[0]))) && val == 1) {
> > +               if (val == 1 && unlikely(len < max_len)) {  
> 
> unlikely? No.

Bah, that was suppose to be "likely()" :-p

> 
> Also, I still think that "len < max_len" should actually be "len <=
> max_len".  It should be ok to use the whole page, no?

Sure, I was still being paranoid. ;-)

> 
> Unless there is some *other* overflow issue, and "len" doesn't contain
> a terminating NUL character or something like that.
> 

No, this is kind of like an internal "malloc", where the caller is
passing in the length via "len" of what it needs.

-- Steve

  reply	other threads:[~2021-06-09 22:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 22:04 [PATCH 0/2] tracing: Simplify and document the trace event filtering temp buffer code Steven Rostedt
2021-06-09 22:04 ` [PATCH 1/2] tracing: Simplify the max length test when using the filtering temp buffer Steven Rostedt
2021-06-09 22:21   ` Linus Torvalds
2021-06-09 22:36     ` Steven Rostedt [this message]
2021-06-09 22:04 ` [PATCH 2/2] tracing: Add better comments for the filtering temp buffer use case Steven Rostedt

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=20210609183653.0b77510c@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).