[PATCH v5 02/15] mm/kasan: rename 'kasan_arg' to 'kasan_arg_disabled'

Baoquan He
2026-02-25T08:17:17Z

And change it to be a bool variable. This is prepared for later
usage.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
mm/kasan/hw_tags.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c
index cbef5e450954..26a69f0d822c 100644
--- a/mm/kasan/hw_tags.c
+++ b/mm/kasan/hw_tags.c
@@ -22,12 +22,6 @@

#include "kasan.h"

-enum kasan_arg {
- KASAN_ARG_DEFAULT,
- KASAN_ARG_OFF,
- KASAN_ARG_ON,
-};
-
enum kasan_arg_mode {
KASAN_ARG_MODE_DEFAULT,
KASAN_ARG_MODE_SYNC,
@@ -41,7 +35,7 @@ enum kasan_arg_vmalloc {
KASAN_ARG_VMALLOC_ON,
};

-static enum kasan_arg kasan_arg __ro_after_init;
+bool kasan_arg_disabled __ro_after_init;
static enum kasan_arg_mode kasan_arg_mode __ro_after_init;
static enum kasan_arg_vmalloc kasan_arg_vmalloc __initdata;

@@ -88,9 +82,9 @@ static int __init early_kasan_flag(char *arg)
return -EINVAL;

if (!strcmp(arg, "off"))
- kasan_arg = KASAN_ARG_OFF;
+ kasan_arg_disabled = true;
else if (!strcmp(arg, "on"))
- kasan_arg = KASAN_ARG_ON;
+ kasan_arg_disabled = false;
else
return -EINVAL;

@@ -222,7 +216,7 @@ void kasan_init_hw_tags_cpu(void)
* When this function is called, kasan_flag_enabled is not yet
* set by kasan_init_hw_tags(). Thus, check kasan_arg instead.
*/
- if (kasan_arg == KASAN_ARG_OFF)
+ if (kasan_arg_disabled)
return;

/*
@@ -240,7 +234,7 @@ void __init kasan_init_hw_tags(void)
return;

/* If KASAN is disabled via command line, don't initialize it. */
- if (kasan_arg == KASAN_ARG_OFF)
+ if (kasan_arg_disabled)
return;

switch (kasan_arg_mode) {