* [PATCH 1/1] crypto: fips: annotate fips_enable() with __init to free init memory after boot
@ 2025-12-08 9:50 Can Peng
2025-12-19 7:07 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Can Peng @ 2025-12-08 9:50 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-crypto, linux-kernel, Can Peng
The fips_enable() function is only invoked early during kernel boot via the
__setup() macro ("fips=" command line parameter), and is never used again
after initialization completes.
Annotating it with __init places the function in the .init.text section,
allowing the kernel to free its memory after init (when freeing_initmem()
runs), reducing runtime memory footprint.
This is a standard practice for setup/early-parse functions and has no
functional impact — the parsing logic, return values, and fips mode
setting behavior remain unchanged.
Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
crypto/fips.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/crypto/fips.c b/crypto/fips.c
index 65d2bc070a26..c59711248d95 100644
--- a/crypto/fips.c
+++ b/crypto/fips.c
@@ -22,7 +22,7 @@ ATOMIC_NOTIFIER_HEAD(fips_fail_notif_chain);
EXPORT_SYMBOL_GPL(fips_fail_notif_chain);
/* Process kernel command-line parameter at boot time. fips=0 or fips=1 */
-static int fips_enable(char *str)
+static int __init fips_enable(char *str)
{
if (kstrtoint(str, 0, &fips_enabled))
return 0;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] crypto: fips: annotate fips_enable() with __init to free init memory after boot
2025-12-08 9:50 [PATCH 1/1] crypto: fips: annotate fips_enable() with __init to free init memory after boot Can Peng
@ 2025-12-19 7:07 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-12-19 7:07 UTC (permalink / raw)
To: Can Peng; +Cc: davem, linux-crypto, linux-kernel
On Mon, Dec 08, 2025 at 05:50:10PM +0800, Can Peng wrote:
> The fips_enable() function is only invoked early during kernel boot via the
> __setup() macro ("fips=" command line parameter), and is never used again
> after initialization completes.
>
> Annotating it with __init places the function in the .init.text section,
> allowing the kernel to free its memory after init (when freeing_initmem()
> runs), reducing runtime memory footprint.
>
> This is a standard practice for setup/early-parse functions and has no
> functional impact — the parsing logic, return values, and fips mode
> setting behavior remain unchanged.
>
> Signed-off-by: Can Peng <pengcan@kylinos.cn>
> ---
> crypto/fips.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-19 7:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08 9:50 [PATCH 1/1] crypto: fips: annotate fips_enable() with __init to free init memory after boot Can Peng
2025-12-19 7:07 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®