From: Balbir Singh <balbirs@nvidia.com>
To: agordeev@linux.ibm.com
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org,
akpm@linux-foundation.org, ryabinin.a.a@gmail.com,
Balbir Singh <balbirs@nvidia.com>
Subject: [PATCH] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
Date: Sat, 13 Sep 2025 09:55:15 +1000 [thread overview]
Message-ID: <20250912235515.367061-1-balbirs@nvidia.com> (raw)
commit c519c3c0a113 ("mm/kasan: avoid lazy MMU mode hazards") introduced
the use of arch_enter_lazy_mmu_mode(), which results in the compiler
complaining about "statement has no effect", when
__HAVE_ARCH_LAZY_MMU_MODE is not defined in include/linux/pgtable.h
The exact warning/error is:
In file included from ./include/linux/kasan.h:37,
from mm/kasan/shadow.c:14:
mm/kasan/shadow.c: In function ‘kasan_populate_vmalloc_pte’:
./include/linux/pgtable.h:247:41: error: statement with no effect [-Werror=unused-value]
247 | #define arch_enter_lazy_mmu_mode() (LAZY_MMU_DEFAULT)
| ^
mm/kasan/shadow.c:322:9: note: in expansion of macro ‘arch_enter_lazy_mmu_mode’
322 | arch_enter_lazy_mmu_mode();
| ^~~~~~~~~~~~~~~~~~~~~~~~
Fix the issue by explicitly casting the use of the function to void,
since the returned state is not forwarded/retained
Fixes: c519c3c0a113 ("mm/kasan: avoid lazy MMU mode hazards")
Signed-off-by: Balbir Singh <balbirs@nvidia.com>
---
mm/kasan/shadow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 60b1b72f5ce1..347e02a70892 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -319,7 +319,7 @@ static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr,
}
spin_unlock(&init_mm.page_table_lock);
- arch_enter_lazy_mmu_mode();
+ (void)arch_enter_lazy_mmu_mode();
return 0;
}
@@ -494,7 +494,7 @@ static int kasan_depopulate_vmalloc_pte(pte_t *ptep, unsigned long addr,
if (likely(!none))
__free_page(pfn_to_page(pte_pfn(pte)));
- arch_enter_lazy_mmu_mode();
+ (void)arch_enter_lazy_mmu_mode();
return 0;
}
--
2.50.1
next reply other threads:[~2025-09-12 23:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 23:55 Balbir Singh [this message]
2025-09-25 23:07 ` Andrew Morton
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=20250912235515.367061-1-balbirs@nvidia.com \
--to=balbirs@nvidia.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.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