linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi: cper: check section header more appropriately
@ 2021-08-23 11:56 Shuai Xue
  2021-08-27 14:04 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Shuai Xue @ 2021-08-23 11:56 UTC (permalink / raw)
  To: ardb; +Cc: xueshuai, linux-efi, linux-kernel, zhangliguang

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 appropiriately
for different revision.

Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
---
 drivers/firmware/efi/cper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index e15d484b6a5a..e80706d9e78a 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -635,7 +635,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);
-- 
2.20.1.12.g72788fdb


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] efi: cper: check section header more appropriately
  2021-08-23 11:56 [PATCH] efi: cper: check section header more appropriately Shuai Xue
@ 2021-08-27 14:04 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2021-08-27 14:04 UTC (permalink / raw)
  To: Shuai Xue; +Cc: linux-efi, Linux Kernel Mailing List, zhangliguang

On Mon, 23 Aug 2021 at 13:57, Shuai Xue <xueshuai@linux.alibaba.com> wrote:
>
> 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 appropiriately
> for different revision.
>
> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>

Applied, thanks.

> ---
>  drivers/firmware/efi/cper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
> index e15d484b6a5a..e80706d9e78a 100644
> --- a/drivers/firmware/efi/cper.c
> +++ b/drivers/firmware/efi/cper.c
> @@ -635,7 +635,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);
> --
> 2.20.1.12.g72788fdb
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-27 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 11:56 [PATCH] efi: cper: check section header more appropriately Shuai Xue
2021-08-27 14:04 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).