[PATCH] mm: do not export const kfree and kstrdup variants

Sergey Senozhatsky posted 1 patch 2 months ago
There is a newer version of this series
mm/util.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] mm: do not export const kfree and kstrdup variants
Posted by Sergey Senozhatsky 2 months ago
Both kfree_const() and kstrdup_const() use __start_rodata
and __end_rodata, which do not work for modules.  This is
especially important for kfree_const().  Stop exporting
these functions, as they cannot be used in the modules.

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 mm/util.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index 4f1275023eb7..aecdc04652c5 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -42,7 +42,6 @@ void kfree_const(const void *x)
 	if (!is_kernel_rodata((unsigned long)x))
 		kfree(x);
 }
-EXPORT_SYMBOL(kfree_const);
 
 /**
  * kstrdup - allocate space for and copy an existing string
-- 
2.46.0.792.g87dc391469-goog
Re: [PATCH] mm: do not export const kfree and kstrdup variants
Posted by Sergey Senozhatsky 2 months ago
On (24/09/24 14:03), Sergey Senozhatsky wrote:
> Both kfree_const() and kstrdup_const() use __start_rodata
> and __end_rodata, which do not work for modules.  This is
> especially important for kfree_const().  Stop exporting
> these functions, as they cannot be used in the modules.

... and of course I forgot to commit the kstrdup_const() part.
Let me resend.