Re: [GIT PULL] ftrace: Check if pages were allocated before calling free_pages()
From: Steven Rostedt
Date: Thu Apr 01 2021 - 16:07:14 EST
On Wed, 31 Mar 2021 11:03:21 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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) {
But as you said, you didn't test it. I'll look to see what else needs to be
fixed.
-- Steve
> /* We should have allocated enough */
> if (WARN_ON(!pg->next))
> break;