diff options
| author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2021-04-21 21:46:36 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-10 12:41:35 +0200 |
| commit | acc1b80d0d4b9821b4a1b29c4b22419fe279de01 (patch) | |
| tree | c8e03ef755a06423efbf8043969eb1d36f4a6bc5 /tools/perf/scripts/python | |
| parent | fc074db66f4e239b9138205560736f5268f30d45 (diff) | |
efi: cper: fix snprintf() use in cper_dimm_err_location()
[ Upstream commit 942859d969de7f6f7f2659a79237a758b42782da ]
snprintf() should be given the full buffer size, not one less. And it
guarantees nul-termination, so doing it manually afterwards is
pointless.
It's even potentially harmful (though probably not in practice because
CPER_REC_LEN is 256), due to the "return how much would have been
written had the buffer been big enough" semantics. I.e., if the bank
and/or device strings are long enough that the "DIMM location ..."
output gets truncated, writing to msg[n] is a buffer overflow.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Fixes: 3760cd20402d4 ("CPER: Adjust code flow of some functions")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
