aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/efi/cper.c
diff options
context:
space:
mode:
authorShuai Xue <xueshuai@linux.alibaba.com>2021-08-23 19:56:54 +0800
committerArd Biesheuvel <ardb@kernel.org>2021-08-27 16:03:01 +0200
commit1be72c8e0786727df375f11c8178ce7e65eea20e (patch)
tree452ab6ca0fc0666a8eb4444b20afb27e3c635b7d /drivers/firmware/efi/cper.c
parentefi: Don't use knowledge about efi_guid_t internals (diff)
downloadlinux-dev-1be72c8e0786727df375f11c8178ce7e65eea20e.tar.xz
linux-dev-1be72c8e0786727df375f11c8178ce7e65eea20e.zip
efi: cper: check section header more appropriately
When checking a generic status block, we iterate over all the generic data blocks. The loop condition checks that the generic data block is valid. Because the size of data blocks (excluding error data) may vary depending on the revision and the revision is contained within the data block, we should ensure that enough of the current data block is valid appropriately for different revision. Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/cper.c')
-rw-r--r--drivers/firmware/efi/cper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index 1cb70976dbe7..73bdbd207e7a 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -632,7 +632,7 @@ int cper_estatus_check(const struct acpi_hest_generic_status *estatus)
data_len = estatus->data_length;
apei_estatus_for_each_section(estatus, gdata) {
- if (sizeof(struct acpi_hest_generic_data) > data_len)
+ if (acpi_hest_get_size(gdata) > data_len)
return -EINVAL;
record_size = acpi_hest_get_record_size(gdata);