2022-06-13 21:23:58

by andrey.konovalov

[permalink] [raw]
Subject: [PATCH 02/32] kasan: rename kasan_set_*_info to kasan_save_*_info

From: Andrey Konovalov <[email protected]>

Rename set_alloc_info() and kasan_set_free_info() to save_alloc_info()
and kasan_save_free_info(). The new names make more sense.

Signed-off-by: Andrey Konovalov <[email protected]>
---
mm/kasan/common.c | 8 ++++----
mm/kasan/generic.c | 2 +-
mm/kasan/kasan.h | 2 +-
mm/kasan/tags.c | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 968d2365d8c1..753775b894b6 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -364,7 +364,7 @@ static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object,
return false;

if (kasan_stack_collection_enabled())
- kasan_set_free_info(cache, object, tag);
+ kasan_save_free_info(cache, object, tag);

return kasan_quarantine_put(cache, object);
}
@@ -423,7 +423,7 @@ void __kasan_slab_free_mempool(void *ptr, unsigned long ip)
}
}

-static void set_alloc_info(struct kmem_cache *cache, void *object,
+static void save_alloc_info(struct kmem_cache *cache, void *object,
gfp_t flags, bool is_kmalloc)
{
struct kasan_alloc_meta *alloc_meta;
@@ -467,7 +467,7 @@ void * __must_check __kasan_slab_alloc(struct kmem_cache *cache,

/* Save alloc info (if possible) for non-kmalloc() allocations. */
if (kasan_stack_collection_enabled())
- set_alloc_info(cache, (void *)object, flags, false);
+ save_alloc_info(cache, (void *)object, flags, false);

return tagged_object;
}
@@ -513,7 +513,7 @@ static inline void *____kasan_kmalloc(struct kmem_cache *cache,
* This also rewrites the alloc info when called from kasan_krealloc().
*/
if (kasan_stack_collection_enabled())
- set_alloc_info(cache, (void *)object, flags, true);
+ save_alloc_info(cache, (void *)object, flags, true);

/* Keep the tag that was set by kasan_slab_alloc(). */
return (void *)object;
diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
index 437fcc7e77cf..03a3770cfeae 100644
--- a/mm/kasan/generic.c
+++ b/mm/kasan/generic.c
@@ -358,7 +358,7 @@ void kasan_record_aux_stack_noalloc(void *addr)
return __kasan_record_aux_stack(addr, false);
}

-void kasan_set_free_info(struct kmem_cache *cache,
+void kasan_save_free_info(struct kmem_cache *cache,
void *object, u8 tag)
{
struct kasan_free_meta *free_meta;
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index 610d60d6e5b8..6df8d7b01073 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -284,7 +284,7 @@ struct slab *kasan_addr_to_slab(const void *addr);

depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc);
void kasan_set_track(struct kasan_track *track, gfp_t flags);
-void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag);
+void kasan_save_free_info(struct kmem_cache *cache, void *object, u8 tag);
struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
void *object, u8 tag);

diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
index 8f48b9502a17..b453a353bc86 100644
--- a/mm/kasan/tags.c
+++ b/mm/kasan/tags.c
@@ -17,7 +17,7 @@

#include "kasan.h"

-void kasan_set_free_info(struct kmem_cache *cache,
+void kasan_save_free_info(struct kmem_cache *cache,
void *object, u8 tag)
{
struct kasan_alloc_meta *alloc_meta;
--
2.25.1


2022-06-20 15:27:41

by Marco Elver

[permalink] [raw]
Subject: Re: [PATCH 02/32] kasan: rename kasan_set_*_info to kasan_save_*_info

On Mon, 13 Jun 2022 at 22:15, <[email protected]> wrote:
>
> From: Andrey Konovalov <[email protected]>
>
> Rename set_alloc_info() and kasan_set_free_info() to save_alloc_info()
> and kasan_save_free_info(). The new names make more sense.
>
> Signed-off-by: Andrey Konovalov <[email protected]>

Reviewed-by: Marco Elver <[email protected]>


> ---
> mm/kasan/common.c | 8 ++++----
> mm/kasan/generic.c | 2 +-
> mm/kasan/kasan.h | 2 +-
> mm/kasan/tags.c | 2 +-
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> index 968d2365d8c1..753775b894b6 100644
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -364,7 +364,7 @@ static inline bool ____kasan_slab_free(struct kmem_cache *cache, void *object,
> return false;
>
> if (kasan_stack_collection_enabled())
> - kasan_set_free_info(cache, object, tag);
> + kasan_save_free_info(cache, object, tag);
>
> return kasan_quarantine_put(cache, object);
> }
> @@ -423,7 +423,7 @@ void __kasan_slab_free_mempool(void *ptr, unsigned long ip)
> }
> }
>
> -static void set_alloc_info(struct kmem_cache *cache, void *object,
> +static void save_alloc_info(struct kmem_cache *cache, void *object,
> gfp_t flags, bool is_kmalloc)
> {
> struct kasan_alloc_meta *alloc_meta;
> @@ -467,7 +467,7 @@ void * __must_check __kasan_slab_alloc(struct kmem_cache *cache,
>
> /* Save alloc info (if possible) for non-kmalloc() allocations. */
> if (kasan_stack_collection_enabled())
> - set_alloc_info(cache, (void *)object, flags, false);
> + save_alloc_info(cache, (void *)object, flags, false);
>
> return tagged_object;
> }
> @@ -513,7 +513,7 @@ static inline void *____kasan_kmalloc(struct kmem_cache *cache,
> * This also rewrites the alloc info when called from kasan_krealloc().
> */
> if (kasan_stack_collection_enabled())
> - set_alloc_info(cache, (void *)object, flags, true);
> + save_alloc_info(cache, (void *)object, flags, true);
>
> /* Keep the tag that was set by kasan_slab_alloc(). */
> return (void *)object;
> diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> index 437fcc7e77cf..03a3770cfeae 100644
> --- a/mm/kasan/generic.c
> +++ b/mm/kasan/generic.c
> @@ -358,7 +358,7 @@ void kasan_record_aux_stack_noalloc(void *addr)
> return __kasan_record_aux_stack(addr, false);
> }
>
> -void kasan_set_free_info(struct kmem_cache *cache,
> +void kasan_save_free_info(struct kmem_cache *cache,
> void *object, u8 tag)
> {
> struct kasan_free_meta *free_meta;
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index 610d60d6e5b8..6df8d7b01073 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -284,7 +284,7 @@ struct slab *kasan_addr_to_slab(const void *addr);
>
> depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc);
> void kasan_set_track(struct kasan_track *track, gfp_t flags);
> -void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag);
> +void kasan_save_free_info(struct kmem_cache *cache, void *object, u8 tag);
> struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
> void *object, u8 tag);
>
> diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
> index 8f48b9502a17..b453a353bc86 100644
> --- a/mm/kasan/tags.c
> +++ b/mm/kasan/tags.c
> @@ -17,7 +17,7 @@
>
> #include "kasan.h"
>
> -void kasan_set_free_info(struct kmem_cache *cache,
> +void kasan_save_free_info(struct kmem_cache *cache,
> void *object, u8 tag)
> {
> struct kasan_alloc_meta *alloc_meta;
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/50cdd8e8d696a8958b7b59c940561c6ed8042436.1655150842.git.andreyknvl%40google.com.