* [PATCH v2] kcov: don't generate a warning on vm_insert_page()'s failure
@ 2022-04-01 8:43 Aleksandr Nogikh
2022-04-01 9:46 ` Marco Elver
0 siblings, 1 reply; 2+ messages in thread
From: Aleksandr Nogikh @ 2022-04-01 8:43 UTC (permalink / raw)
To: kasan-dev, linux-kernel, akpm
Cc: dvyukov, andreyknvl, elver, glider, tarasmadan, bigeasy, nogikh
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@google.com>
PATCH v2:
* Added a newline at the end of pr_warn_once().
PATCH v1: https://lkml.org/lkml/2022/3/31/909
---
kernel/kcov.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 475524bd900a..b3732b210593 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\n");
+ return res;
+ }
}
return 0;
exit:
--
2.35.1.1094.g7c7d902a7c-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] kcov: don't generate a warning on vm_insert_page()'s failure
2022-04-01 8:43 [PATCH v2] kcov: don't generate a warning on vm_insert_page()'s failure Aleksandr Nogikh
@ 2022-04-01 9:46 ` Marco Elver
0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2022-04-01 9:46 UTC (permalink / raw)
To: Aleksandr Nogikh
Cc: kasan-dev, linux-kernel, akpm, dvyukov, andreyknvl, glider,
tarasmadan, bigeasy
On Fri, 1 Apr 2022 at 10:43, Aleksandr Nogikh <nogikh@google.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@google.com>
Acked-by: Marco Elver <elver@google.com>
Just minor "process" comments:
1) There should be a '---' so that the below doesn't appear in the
commit message on 'git am' and maintainers don't have to manually
remove it.
> PATCH v2:
> * Added a newline at the end of pr_warn_once().
>
> PATCH v1: https://lkml.org/lkml/2022/3/31/909
2) We should use lore permalinks, because lkml.org isn't official and
was actually down most of this week. v1 was
https://lore.kernel.org/all/20220331180501.4130549-1-nogikh@google.com/
> ---
> kernel/kcov.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 475524bd900a..b3732b210593 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\n");
> + return res;
> + }
> }
> return 0;
> exit:
> --
> 2.35.1.1094.g7c7d902a7c-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-01 9:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 8:43 [PATCH v2] kcov: don't generate a warning on vm_insert_page()'s failure Aleksandr Nogikh
2022-04-01 9:46 ` Marco Elver
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).