lkml.org 
[lkml]   [2021]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()
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

\
 
 \ /
  Last update: 2021-04-01 22:54    [W:0.075 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site