Skip to content

Commit

Permalink
efi: cper: check section header more appropriately
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shuai Xue authored and Ard Biesheuvel committed Aug 27, 2021
1 parent b31eea2 commit 1be72c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firmware/efi/cper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1be72c8

Please sign in to comment.