Skip to content

Commit b3a72ca

Browse files
committed
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: <[email protected]> Reported-by: Joe Perches <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 68c9cdf commit b3a72ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firmware/efi/cper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#include <acpi/ghes.h>
2626
#include <ras/ras_event.h>
2727

28-
static char rcd_decode_str[CPER_REC_LEN];
29-
3028
/*
3129
* CPER record ID need to be unique even after reboot, because record
3230
* 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,
312310
struct cper_mem_err_compact *cmem)
313311
{
314312
const char *ret = trace_seq_buffer_ptr(p);
313+
char rcd_decode_str[CPER_REC_LEN];
315314

316315
if (cper_mem_err_location(cmem, rcd_decode_str))
317316
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,
326325
int len)
327326
{
328327
struct cper_mem_err_compact cmem;
328+
char rcd_decode_str[CPER_REC_LEN];
329329

330330
/* Don't trust UEFI 2.1/2.2 structure with bad validation bits */
331331
if (len == sizeof(struct cper_sec_mem_err_old) &&

0 commit comments

Comments
 (0)