[PATCH v5 05/15] mm/kasan/sw_tags: don't initialize kasan if it's disabled

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

Here, kasan is disabled if specified 'kasan=off' in kernel cmdline.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
mm/kasan/sw_tags.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/mm/kasan/sw_tags.c b/mm/kasan/sw_tags.c
index 6c1caec4261a..7757b69b1c86 100644
--- a/mm/kasan/sw_tags.c
+++ b/mm/kasan/sw_tags.c
@@ -40,6 +40,10 @@ void __init kasan_init_sw_tags(void)
{
int cpu;

+ /* If KASAN is disabled via command line, don't initialize it. */
+ if (kasan_arg_disabled)
+ return;
+
for_each_possible_cpu(cpu)
per_cpu(prng_state, cpu) = (u32)get_cycles();

--
2.52.0