From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()
Date: Thu, 1 Apr 2021 16:53:04 -0400 [thread overview]
Message-ID: <20210401165304.187c7f7e@gandalf.local.home> (raw)
In-Reply-To: <CAHk-=wg_6JBGSiKtQp7CT99kFt2L5b1sbvs6YBTXJAWdPc8Hig@mail.gmail.com>
On Thu, 1 Apr 2021 13:18:59 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, Apr 1, 2021 at 1:07 PM Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > On Wed, 31 Mar 2021 11:03:21 -0700
> > Linus Torvalds <torvalds@linux-foundation.org> wrote:
> >
> > > @@ -6231,7 +6231,8 @@ static int ftrace_process_locs(struct module *mod,
> > > if (!addr)
> > > continue;
> > >
> > > - if (pg->index == pg->size) {
> > > + end_offset = (pg->index+1) * sizeof(pg->records[0]);
> > > + if (end_offset < PAGE_SIZE << pg->order) {
> >
> > I believe that needs to be:
> >
> > if (end_offset >= PAGE_SIZE << pg->order) {
>
[..]
> which will be
>
> end_offset = (3+1) * 1024;
>
> ie 4096. That just means that the struct fill fill things _up_to_ the
> end of the page.
>
> So only when the end_offset is strictly larger than the page would it
> have overflowed the allocation.
Ah, I forgot about the "+1" you added to the pg->index, which would make it
equivalent to replacing:
if (pg->index + 1 > pg->size) {
Will update and add your SOB.
Thanks,
-- Steve
next prev parent reply other threads:[~2021-04-01 20:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-31 13:27 [GIT PULL] ftrace: Check if pages were allocated before calling free_pages() Steven Rostedt
2021-03-31 17:45 ` Linus Torvalds
2021-03-31 18:03 ` Linus Torvalds
2021-03-31 19:03 ` Steven Rostedt
2021-04-01 20:07 ` Steven Rostedt
2021-04-01 20:18 ` Linus Torvalds
2021-04-01 20:53 ` Steven Rostedt [this message]
2021-04-01 20:25 ` Steven Rostedt
2021-03-31 18:51 ` Steven Rostedt
2021-03-31 19:01 ` Linus Torvalds
2021-03-31 18:05 ` pr-tracker-bot
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=20210401165304.187c7f7e@gandalf.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).