[PATCH v2 1/2] vsprintf: Only export no_hash_pointers to test module
From: Thomas Weißschuh
Date: Mon May 04 2026 - 06:43:59 EST
Aside from the printf test module, no module should ever use this symbol.
Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
Link: https://lore.kernel.org/all/aWpwMyFEfpCNN297@xxxxxxxxxxxxxxx/
Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/all/aW3em-KplLVofU5z@xxxxxxxxxxxxxxxxxx/
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
lib/vsprintf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 9f359b31c8d1..f70d240a394c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -59,7 +59,9 @@
/* Disable pointer hashing if requested */
bool no_hash_pointers __ro_after_init;
-EXPORT_SYMBOL_GPL(no_hash_pointers);
+#if IS_MODULE(CONFIG_PRINTF_KUNIT_TEST)
+EXPORT_SYMBOL_FOR_MODULES(no_hash_pointers, "printf_kunit");
+#endif
/*
* Hashed pointers policy selected by "hash_pointers=..." boot param
--
2.53.0