Commit b3a72ca8 authored by Ard Biesheuvel's avatar Ard Biesheuvel

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent 68c9cdf3
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <acpi/ghes.h> #include <acpi/ghes.h>
#include <ras/ras_event.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 * CPER record ID need to be unique even after reboot, because record
* ID is used as index for ERST storage, while CPER records from * 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, ...@@ -312,6 +310,7 @@ const char *cper_mem_err_unpack(struct trace_seq *p,
struct cper_mem_err_compact *cmem) struct cper_mem_err_compact *cmem)
{ {
const char *ret = trace_seq_buffer_ptr(p); const char *ret = trace_seq_buffer_ptr(p);
char rcd_decode_str[CPER_REC_LEN];
if (cper_mem_err_location(cmem, rcd_decode_str)) if (cper_mem_err_location(cmem, rcd_decode_str))
trace_seq_printf(p, "%s", 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, ...@@ -326,6 +325,7 @@ static void cper_print_mem(const char *pfx, const struct cper_sec_mem_err *mem,
int len) int len)
{ {
struct cper_mem_err_compact cmem; 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 */ /* Don't trust UEFI 2.1/2.2 structure with bad validation bits */
if (len == sizeof(struct cper_sec_mem_err_old) && if (len == sizeof(struct cper_sec_mem_err_old) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment