All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kasan: Mark unpoison_slab_object() as static
@ 2023-12-21 17:26 Nathan Chancellor
  2023-12-21 17:33 ` Andrey Konovalov
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2023-12-21 17:26 UTC (permalink / raw)
  To: akpm, andreyknvl, ryabinin.a.a
  Cc: glider, dvyukov, vincenzo.frascino, kasan-dev, linux-mm, patches,
	Nathan Chancellor

With -Wmissing-prototypes enabled, there is a warning that
unpoison_slab_object() has no prototype, breaking the build with
CONFIG_WERROR=y:

  mm/kasan/common.c:271:6: error: no previous prototype for 'unpoison_slab_object' [-Werror=missing-prototypes]
    271 | void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
        |      ^~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

Mark the function as static, as it is not used outside of this
translation unit, clearing up the warning.

Fixes: 3f38c3c5bc40 ("kasan: save alloc stack traces for mempool")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 mm/kasan/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index ebb1b23d6480..563cda95240b 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -277,8 +277,8 @@ void __kasan_kfree_large(void *ptr, unsigned long ip)
 	/* The object will be poisoned by kasan_poison_pages(). */
 }
 
-void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
-			  bool init)
+static void unpoison_slab_object(struct kmem_cache *cache, void *object,
+				 gfp_t flags, bool init)
 {
 	/*
 	 * Unpoison the whole object. For kmalloc() allocations,

---
base-commit: eacce8189e28717da6f44ee492b7404c636ae0de
change-id: 20231221-mark-unpoison_slab_object-as-static-3bf224e1527f

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kasan: Mark unpoison_slab_object() as static
  2023-12-21 17:26 [PATCH] kasan: Mark unpoison_slab_object() as static Nathan Chancellor
@ 2023-12-21 17:33 ` Andrey Konovalov
  2023-12-21 18:00   ` Andrey Konovalov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Konovalov @ 2023-12-21 17:33 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: akpm, ryabinin.a.a, glider, dvyukov, vincenzo.frascino,
	kasan-dev, linux-mm, patches

On Thu, Dec 21, 2023 at 6:27 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> With -Wmissing-prototypes enabled, there is a warning that
> unpoison_slab_object() has no prototype, breaking the build with
> CONFIG_WERROR=y:
>
>   mm/kasan/common.c:271:6: error: no previous prototype for 'unpoison_slab_object' [-Werror=missing-prototypes]
>     271 | void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
>         |      ^~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
>
> Mark the function as static, as it is not used outside of this
> translation unit, clearing up the warning.
>
> Fixes: 3f38c3c5bc40 ("kasan: save alloc stack traces for mempool")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  mm/kasan/common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> index ebb1b23d6480..563cda95240b 100644
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -277,8 +277,8 @@ void __kasan_kfree_large(void *ptr, unsigned long ip)
>         /* The object will be poisoned by kasan_poison_pages(). */
>  }
>
> -void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
> -                         bool init)
> +static void unpoison_slab_object(struct kmem_cache *cache, void *object,
> +                                gfp_t flags, bool init)
>  {
>         /*
>          * Unpoison the whole object. For kmalloc() allocations,
>
> ---
> base-commit: eacce8189e28717da6f44ee492b7404c636ae0de
> change-id: 20231221-mark-unpoison_slab_object-as-static-3bf224e1527f
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>

Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>

I'll fold this fix into v2 if I end up resending the series.

Thank you, Nathan!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kasan: Mark unpoison_slab_object() as static
  2023-12-21 17:33 ` Andrey Konovalov
@ 2023-12-21 18:00   ` Andrey Konovalov
  0 siblings, 0 replies; 3+ messages in thread
From: Andrey Konovalov @ 2023-12-21 18:00 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: akpm, ryabinin.a.a, glider, dvyukov, vincenzo.frascino,
	kasan-dev, linux-mm, patches

On Thu, Dec 21, 2023 at 6:33 PM Andrey Konovalov <andreyknvl@gmail.com> wrote:
>
> On Thu, Dec 21, 2023 at 6:27 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >
> > With -Wmissing-prototypes enabled, there is a warning that
> > unpoison_slab_object() has no prototype, breaking the build with
> > CONFIG_WERROR=y:
> >
> >   mm/kasan/common.c:271:6: error: no previous prototype for 'unpoison_slab_object' [-Werror=missing-prototypes]
> >     271 | void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
> >         |      ^~~~~~~~~~~~~~~~~~~~
> >   cc1: all warnings being treated as errors
> >
> > Mark the function as static, as it is not used outside of this
> > translation unit, clearing up the warning.
> >
> > Fixes: 3f38c3c5bc40 ("kasan: save alloc stack traces for mempool")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >  mm/kasan/common.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> > index ebb1b23d6480..563cda95240b 100644
> > --- a/mm/kasan/common.c
> > +++ b/mm/kasan/common.c
> > @@ -277,8 +277,8 @@ void __kasan_kfree_large(void *ptr, unsigned long ip)
> >         /* The object will be poisoned by kasan_poison_pages(). */
> >  }
> >
> > -void unpoison_slab_object(struct kmem_cache *cache, void *object, gfp_t flags,
> > -                         bool init)
> > +static void unpoison_slab_object(struct kmem_cache *cache, void *object,
> > +                                gfp_t flags, bool init)
> >  {
> >         /*
> >          * Unpoison the whole object. For kmalloc() allocations,
> >
> > ---
> > base-commit: eacce8189e28717da6f44ee492b7404c636ae0de
> > change-id: 20231221-mark-unpoison_slab_object-as-static-3bf224e1527f
> >
> > Best regards,
> > --
> > Nathan Chancellor <nathan@kernel.org>
> >
>
> Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
>
> I'll fold this fix into v2 if I end up resending the series.
>
> Thank you, Nathan!

Let's actually mark it as "static inline", I'll send a v2.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-21 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 17:26 [PATCH] kasan: Mark unpoison_slab_object() as static Nathan Chancellor
2023-12-21 17:33 ` Andrey Konovalov
2023-12-21 18:00   ` Andrey Konovalov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.