[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANpmjNMVVRg6sVREDYGCiSPO6GOpWd4wuMnyNM5=wRJJvox4bQ@mail.gmail.com>
Date: Tue, 18 Apr 2023 12:10:57 +0200
From: Marco Elver <elver@...gle.com>
To: Alexander Potapenko <glider@...gle.com>
Cc: urezki@...il.com, hch@...radead.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, akpm@...ux-foundation.org, dvyukov@...gle.com,
kasan-dev@...glegroups.com,
Dipanjan Das <mail.dipanjan.das@...il.com>
Subject: Re: [PATCH v2 4/4] mm: apply __must_check to vmap_pages_range_noflush()
On Thu, 13 Apr 2023 at 15:12, Alexander Potapenko <glider@...gle.com> wrote:
>
> To prevent errors when vmap_pages_range_noflush() or
> __vmap_pages_range_noflush() silently fail (see the link below for an
> example), annotate them with __must_check so that the callers do not
> unconditionally assume the mapping succeeded.
>
> Reported-by: Dipanjan Das <mail.dipanjan.das@...il.com>
> Link: https://lore.kernel.org/linux-mm/CANX2M5ZRrRA64k0hOif02TjmY9kbbO2aCBPyq79es34RXZ=cAw@mail.gmail.com/
> Signed-off-by: Alexander Potapenko <glider@...gle.com>
Reviewed-by: Marco Elver <elver@...gle.com>
> ---
> mm/internal.h | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index 7920a8b7982ec..a646cf7c41e8a 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -833,20 +833,20 @@ size_t splice_folio_into_pipe(struct pipe_inode_info *pipe,
> * mm/vmalloc.c
> */
> #ifdef CONFIG_MMU
> -int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> - pgprot_t prot, struct page **pages, unsigned int page_shift);
> +int __must_check vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> + pgprot_t prot, struct page **pages, unsigned int page_shift);
> #else
> static inline
> -int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> - pgprot_t prot, struct page **pages, unsigned int page_shift)
> +int __must_check vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> + pgprot_t prot, struct page **pages, unsigned int page_shift)
> {
> return -EINVAL;
> }
> #endif
>
> -int __vmap_pages_range_noflush(unsigned long addr, unsigned long end,
> - pgprot_t prot, struct page **pages,
> - unsigned int page_shift);
> +int __must_check __vmap_pages_range_noflush(
> + unsigned long addr, unsigned long end, pgprot_t prot,
> + struct page **pages, unsigned int page_shift);
>
> void vunmap_range_noflush(unsigned long start, unsigned long end);
>
> --
> 2.40.0.577.gac1e443424-goog
>
Powered by blists - more mailing lists