linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@gmail.com>
To: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Cc: ryabinin.a.a@gmail.com, glider@google.com, dvyukov@google.com,
	 vincenzo.frascino@arm.com, akpm@linux-foundation.org,
	bhe@redhat.com,  christophe.leroy@csgroup.eu,
	ritesh.list@gmail.com,  kasan-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/2] kasan: remove __kasan_save_free_info wrapper
Date: Wed, 22 Oct 2025 01:07:07 +0200	[thread overview]
Message-ID: <CA+fCnZfwPU0_LJQsCbatD3kd8vLE-ep06vZikNaR0W6-6UrkDQ@mail.gmail.com> (raw)
In-Reply-To: <20251009155403.1379150-2-snovitoll@gmail.com>

On Thu, Oct 9, 2025 at 5:54 PM Sabyrzhan Tasbolatov <snovitoll@gmail.com> wrote:
>
> We don't need a kasan_enabled() check in
> kasan_save_free_info() at all. Both the higher level paths
> (kasan_slab_free and kasan_mempool_poison_object) already contain this
> check. Therefore, remove the __wrapper.
>
> Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
> Fixes: 1e338f4d99e6 ("kasan: introduce ARCH_DEFER_KASAN and unify static key across modes")
> ---
>  mm/kasan/generic.c | 2 +-
>  mm/kasan/kasan.h   | 7 +------
>  mm/kasan/tags.c    | 2 +-
>  3 files changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> index b413c46b3e0..516b49accc4 100644
> --- a/mm/kasan/generic.c
> +++ b/mm/kasan/generic.c
> @@ -573,7 +573,7 @@ void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags)
>         kasan_save_track(&alloc_meta->alloc_track, flags);
>  }
>
> -void __kasan_save_free_info(struct kmem_cache *cache, void *object)
> +void kasan_save_free_info(struct kmem_cache *cache, void *object)
>  {
>         struct kasan_free_meta *free_meta;
>
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index 07fa7375a84..fc9169a5476 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -399,12 +399,7 @@ void kasan_set_track(struct kasan_track *track, depot_stack_handle_t stack);
>  void kasan_save_track(struct kasan_track *track, gfp_t flags);
>  void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags);
>
> -void __kasan_save_free_info(struct kmem_cache *cache, void *object);
> -static inline void kasan_save_free_info(struct kmem_cache *cache, void *object)
> -{
> -       if (kasan_enabled())
> -               __kasan_save_free_info(cache, object);
> -}
> +void kasan_save_free_info(struct kmem_cache *cache, void *object);
>
>  #ifdef CONFIG_KASAN_GENERIC
>  bool kasan_quarantine_put(struct kmem_cache *cache, void *object);
> diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
> index b9f31293622..d65d48b85f9 100644
> --- a/mm/kasan/tags.c
> +++ b/mm/kasan/tags.c
> @@ -142,7 +142,7 @@ void kasan_save_alloc_info(struct kmem_cache *cache, void *object, gfp_t flags)
>         save_stack_info(cache, object, flags, false);
>  }
>
> -void __kasan_save_free_info(struct kmem_cache *cache, void *object)
> +void kasan_save_free_info(struct kmem_cache *cache, void *object)
>  {
>         save_stack_info(cache, object, 0, true);
>  }
> --
> 2.34.1
>

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


  reply	other threads:[~2025-10-21 23:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 15:54 [PATCH 0/2] kasan: cleanups for kasan_enabled() checks Sabyrzhan Tasbolatov
2025-10-09 15:54 ` [PATCH 1/2] kasan: remove __kasan_save_free_info wrapper Sabyrzhan Tasbolatov
2025-10-21 23:07   ` Andrey Konovalov [this message]
2025-10-09 15:54 ` [PATCH 2/2] kasan: cleanup of kasan_enabled() checks Sabyrzhan Tasbolatov
2025-10-21 23:07   ` Andrey Konovalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+fCnZfwPU0_LJQsCbatD3kd8vLE-ep06vZikNaR0W6-6UrkDQ@mail.gmail.com \
    --to=andreyknvl@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ritesh.list@gmail.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=snovitoll@gmail.com \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox