[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANpmjNMcjocJfA_8Qmg+Vx2FBQ7+m8JUXdQm4aAj-zeb4B35Kw@mail.gmail.com>
Date: Thu, 31 Mar 2022 20:09:05 +0200
From: Marco Elver <elver@...gle.com>
To: Aleksandr Nogikh <nogikh@...gle.com>
Cc: kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org, dvyukov@...gle.com,
andreyknvl@...il.com, glider@...gle.com, tarasmadan@...gle.com,
bigeasy@...utronix.de
Subject: Re: [PATCH] kcov: don't generate a warning on vm_insert_page()'s failure
On Thu, 31 Mar 2022 at 20:05, Aleksandr Nogikh <nogikh@...gle.com> wrote:
>
> vm_insert_page()'s failure is not an unexpected condition, so don't do
> WARN_ONCE() in such a case.
>
> Instead, print a kernel message and just return an error code.
>
> Signed-off-by: Aleksandr Nogikh <nogikh@...gle.com>
> ---
> kernel/kcov.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 475524bd900a..961536a03127 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -475,8 +475,11 @@ static int kcov_mmap(struct file *filep, struct vm_area_struct *vma)
> vma->vm_flags |= VM_DONTEXPAND;
> for (off = 0; off < size; off += PAGE_SIZE) {
> page = vmalloc_to_page(kcov->area + off);
> - if (vm_insert_page(vma, vma->vm_start + off, page))
> - WARN_ONCE(1, "vm_insert_page() failed");
> + res = vm_insert_page(vma, vma->vm_start + off, page);
> + if (res) {
> + pr_warn_once("kcov: vm_insert_page() failed");
pr_*() should be terminated by "\n" -- sorry, I missed this.
> + return res;
> + }
> }
> return 0;
> exit:
> --
> 2.35.1.1094.g7c7d902a7c-goog
>
Powered by blists - more mailing lists