linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode()
@ 2025-09-12 23:55 Balbir Singh
  2025-09-25 23:07 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Balbir Singh @ 2025-09-12 23:55 UTC (permalink / raw)
  To: agordeev; +Cc: kasan-dev, linux-mm, akpm, ryabinin.a.a, Balbir Singh

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-25 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 23:55 [PATCH] kasan: Fix warnings caused by use of arch_enter_lazy_mmu_mode() Balbir Singh
2025-09-25 23:07 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox