linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: efi/urgent] efi/cper: use stack buffer for error record decoding
@ 2021-10-15  9:06 tip-bot2 for Ard Biesheuvel
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Ard Biesheuvel @ 2021-10-15  9:06 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: stable, Joe Perches, Ard Biesheuvel, x86, linux-kernel

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     b3a72ca80351917cc23f9e24c35f3c3979d3c121
Gitweb:        https://git.kernel.org/tip/b3a72ca80351917cc23f9e24c35f3c3979d3c121
Author:        Ard Biesheuvel <ardb@kernel.org>
AuthorDate:    Wed, 01 Sep 2021 08:33:19 +02:00
Committer:     Ard Biesheuvel <ardb@kernel.org>
CommitterDate: Tue, 05 Oct 2021 13:05:59 +02:00

efi/cper: use stack buffer for error record decoding

Joe reports that using a statically allocated buffer for converting CPER
error records into human readable text is probably a bad idea. Even
though we are not aware of any actual issues, a stack buffer is clearly
a better choice here anyway, so let's move the buffer into the stack
frames of the two functions that refer to it.

Cc: <stable@vger.kernel.org>
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/cper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index 73bdbd2..6ec8ede 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -25,8 +25,6 @@
 #include <acpi/ghes.h>
 #include <ras/ras_event.h>
 
-static char rcd_decode_str[CPER_REC_LEN];
-
 /*
  * CPER record ID need to be unique even after reboot, because record
  * ID is used as index for ERST storage, while CPER records from
@@ -312,6 +310,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p,
 				struct cper_mem_err_compact *cmem)
 {
 	const char *ret = trace_seq_buffer_ptr(p);
+	char rcd_decode_str[CPER_REC_LEN];
 
 	if (cper_mem_err_location(cmem, rcd_decode_str))
 		trace_seq_printf(p, "%s", rcd_decode_str);
@@ -326,6 +325,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,
 	int len)
 {
 	struct cper_mem_err_compact cmem;
+	char rcd_decode_str[CPER_REC_LEN];
 
 	/* Don't trust UEFI 2.1/2.2 structure with bad validation bits */
 	if (len == sizeof(struct cper_sec_mem_err_old) &&

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-15  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15  9:06 [tip: efi/urgent] efi/cper: use stack buffer for error record decoding tip-bot2 for Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).