linux-stable/drivers/firmware/efi
Rasmus Villemoes 8d27efbb0e efi: cper: fix snprintf() use in cper_dimm_err_location()
[ Upstream commit 942859d969 ]

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 13:39:14 +02:00
..
libstub efi/libstub: prevent read overflow in find_file_option() 2021-06-10 13:39:14 +02:00
test efi_test: get rid of pointless access_ok() 2020-05-29 11:05:54 -04:00
apple-properties.c efi/apple-properties: Reinstate support for boolean properties 2021-02-03 23:28:40 +01:00
arm-runtime.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
capsule-loader.c efi/capsule-loader: Drop superfluous assignment 2020-02-23 21:58:31 +01:00
capsule.c efi: Replace GPL license boilerplate with SPDX headers 2019-02-04 08:27:25 +01:00
cper-arm.c efi: Replace GPL license boilerplate with SPDX headers 2019-02-04 08:27:25 +01:00
cper-x86.c efi: Decode IA32/X64 Context Info structure 2018-05-14 08:57:48 +02:00
cper.c efi: cper: fix snprintf() use in cper_dimm_err_location() 2021-06-10 13:39:14 +02:00
dev-path-parser.c efi/dev-path-parser: Add struct definition for vendor type device path nodes 2020-02-23 21:59:42 +01:00
earlycon.c efi/earlycon: Fix early printk for wider fonts 2020-05-12 12:29:45 +02:00
efi-bgrt.c efi/bgrt: Accept BGRT tables with a version of 0 2020-02-22 23:37:37 +01:00
efi-init.c efi: Support for MOK variable config table 2020-09-16 18:53:42 +03:00
efi-pstore.c efi: pstore: move workqueue handling out of efivars 2020-09-29 19:40:57 +02:00
efi.c firmware/efi: Fix a use after bug in efi_mem_reserve_persistent 2021-03-25 09:04:18 +01:00
efibc.c efi: efibc: check for efivars write capability 2020-09-15 18:22:47 +03:00
efivars.c efi: efivars: limit availability to X86 builds 2020-09-29 19:40:57 +02:00
embedded-firmware.c test_firmware: Test platform fw loading on non-EFI systems 2020-09-10 18:19:16 +02:00
esrt.c efi/esrt: Fix reference count leak in esre_create_sysfs_entry. 2020-06-15 14:38:56 +02:00
fake_mem.c efi: Fix handling of multiple efi_fake_mem= entries 2020-01-20 08:14:29 +01:00
fake_mem.h x86/efi: Add efi_fake_mem support for EFI_MEMORY_SP 2019-11-07 15:44:23 +01:00
fdtparams.c efi/fdt: fix panic when no valid fdt found 2021-06-10 13:39:13 +02:00
Kconfig efi: EFI_EARLYCON should depend on EFI 2020-11-25 16:55:02 +01:00
Makefile RISC-V Patches for the 5.10 Merge Window, Part 1 2020-10-19 18:18:30 -07:00
memattr.c efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared 2021-06-10 13:39:14 +02:00
memmap.c efi: Fix handling of multiple efi_fake_mem= entries 2020-01-20 08:14:29 +01:00
mokvar-table.c efi: mokvar: add missing include of asm/early_ioremap.h 2020-10-02 10:08:29 +02:00
rci2-table.c efi: Don't attempt to map RCI2 config table if it doesn't exist 2019-12-10 12:13:02 +01:00
reboot.c efi: Use EFI ResetSystem only when available 2020-02-23 21:59:42 +01:00
riscv-runtime.c RISC-V: Add EFI runtime services 2020-10-02 14:31:28 -07:00
runtime-map.c efi: Replace GPL license boilerplate with SPDX headers 2019-02-04 08:27:25 +01:00
runtime-wrappers.c efi: Add 'runtime' pointer to struct efi 2020-02-23 21:59:42 +01:00
tpm.c EFI fixes for v5.7-rc6: 2020-05-22 20:06:25 +02:00
vars.c efivars: respect EFI_UNSUPPORTED return from firmware 2021-03-25 09:04:17 +01:00
x86_fake_mem.c efi/fake_mem: arrange for a resource entry per efi_fake_mem instance 2020-10-13 18:38:27 -07:00