android_kernel_xiaomi_sdm845/drivers/firmware/efi
Rasmus Villemoes fc0138fa0c 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: 3760cd2040 ("CPER: Adjust code flow of some functions")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-10 12:42:35 +02:00
..
libstub
test
arm-init.c
arm-runtime.c
capsule-loader.c
capsule.c
cper.c efi: cper: fix snprintf() use in cper_dimm_err_location() 2021-06-10 12:42:35 +02:00
efi-pstore.c
efi.c efi: Make it possible to disable efivar_ssdt entirely 2020-07-09 09:35:57 +02:00
efibc.c
efivars.c efi/efivars: Add missing kobject_put() in sysfs entry creation error path 2020-06-20 10:24:09 +02:00
esrt.c efi/esrt: Fix reference count leak in esre_create_sysfs_entry. 2020-06-30 15:38:42 -04:00
fake_mem.c
Kconfig efi: Make it possible to disable efivar_ssdt entirely 2020-07-09 09:35:57 +02:00
Makefile
memattr.c efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared 2021-06-10 12:42:35 +02:00
memmap.c
reboot.c
runtime-map.c
runtime-wrappers.c
vars.c