Skip to content

Commit

Permalink
x86/mm: Free sme_early_buffer after init
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
rientjes authored and KAGA-KOKO committed Jul 16, 2019
1 parent e74bd96 commit ffdb07f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/mm/mem_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ffdb07f

Please sign in to comment.