[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210401165304.187c7f7e@gandalf.local.home>
Date: Thu, 1 Apr 2021 16:53:04 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [GIT PULL] ftrace: Check if pages were allocated before calling
free_pages()
On Thu, 1 Apr 2021 13:18:59 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Thu, Apr 1, 2021 at 1:07 PM Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > On Wed, 31 Mar 2021 11:03:21 -0700
> > Linus Torvalds <torvalds@...ux-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
Powered by blists - more mailing lists