summaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorDavid Rientjes2019-07-10 22:19:35 +0200
committerThomas Gleixner2019-07-16 23:13:48 +0200
commitffdb07f31252625b7bcbf1f424d7beccff02ba97 (patch)
treeca21912b745930c66e86cb14826cd5e3476e9597 /arch/x86/mm
parentx86/boot: Fix memory leak in default_get_smp_config() (diff)
downloadkernel-qcow2-linux-ffdb07f31252625b7bcbf1f424d7beccff02ba97.tar.gz
kernel-qcow2-linux-ffdb07f31252625b7bcbf1f424d7beccff02ba97.tar.xz
kernel-qcow2-linux-ffdb07f31252625b7bcbf1f424d7beccff02ba97.zip
x86/mm: Free sme_early_buffer after init
The contents of sme_early_buffer should be cleared after __sme_early_enc_dec() because it is used to move encrypted and decrypted data, but since __sme_early_enc_dec() is __init this buffer simply can be freed after init. This saves a page that is otherwise unreferenced after init. Reported-by: Cfir Cohen <cfir@google.com> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1907101318170.197432@chino.kir.corp.google.com
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/mem_encrypt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c
index e0df96fdfe46..e94e0a62ba92 100644
--- a/arch/x86/mm/mem_encrypt.c
+++ b/arch/x86/mm/mem_encrypt.c
@@ -41,7 +41,7 @@ EXPORT_SYMBOL_GPL(sev_enable_key);
bool sev_enabled __section(.data);
/* Buffer used for early in-place encryption by BSP, no locking needed */
-static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE);
+static char sme_early_buffer[PAGE_SIZE] __initdata __aligned(PAGE_SIZE);
/*
* This routine does not change the underlying encryption setting of the