[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201007252223.32671.bjorn.helgaas@hp.com>
Date: Sun, 25 Jul 2010 22:23:32 -0600
From: Bjorn Helgaas <bjorn.helgaas@...com>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Len Brown <lenb@...nel.org>, Huang Ying <ying.huang@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Tejun Heo <tj@...nel.org>,
Daniel J Blueman <daniel.blueman@...il.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] acpi: fix apei related table size checking
On Friday, July 23, 2010 11:39:17 am Yinghai Lu wrote:
>
> also check if we can find right action in apei.
>
> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
This should be split into two patches that each fix one thing.
> ---
> drivers/acpi/apei/apei-base.c | 5 +++++
> drivers/acpi/apei/einj.c | 3 ++-
> drivers/acpi/apei/erst.c | 3 ++-
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/drivers/acpi/apei/einj.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/apei/einj.c
> +++ linux-2.6/drivers/acpi/apei/einj.c
> @@ -426,7 +426,8 @@ DEFINE_SIMPLE_ATTRIBUTE(error_inject_fop
>
> static int einj_check_table(struct acpi_table_einj *einj_tab)
> {
> - if (einj_tab->header_length != sizeof(struct acpi_table_einj))
> + if (einj_tab->header_length !=
> + (sizeof(struct acpi_table_einj) - sizeof(einj_tab->header)))
> return -EINVAL;
> if (einj_tab->header.length < sizeof(struct acpi_table_einj))
> return -EINVAL;
> Index: linux-2.6/drivers/acpi/apei/erst.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/apei/erst.c
> +++ linux-2.6/drivers/acpi/apei/erst.c
> @@ -749,7 +749,8 @@ __setup("erst_disable", setup_erst_disab
>
> static int erst_check_table(struct acpi_table_erst *erst_tab)
> {
> - if (erst_tab->header_length != sizeof(struct acpi_table_erst))
> + if (erst_tab->header_length !=
> + (sizeof(struct acpi_table_erst) - sizeof(erst_tab->header)))
> return -EINVAL;
> if (erst_tab->header.length < sizeof(struct acpi_table_erst))
> return -EINVAL;
> Index: linux-2.6/drivers/acpi/apei/apei-base.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/apei/apei-base.c
> +++ linux-2.6/drivers/acpi/apei/apei-base.c
> @@ -163,6 +163,7 @@ int apei_exec_run(struct apei_exec_conte
> u32 i, ip;
> struct acpi_whea_header *entry;
> apei_exec_ins_func_t run;
> + bool found_action = false;
>
> ctx->ip = 0;
>
> @@ -178,6 +179,7 @@ rewind:
> entry = &ctx->action_table[i];
> if (entry->action != action)
> continue;
> + found_action = true;
> if (ip == ctx->ip) {
> if (entry->instruction >= ctx->instructions ||
> !ctx->ins_table[entry->instruction].run) {
> @@ -198,6 +200,9 @@ rewind:
> goto rewind;
> }
>
> + if (!found_action)
> + return -ENODEV;
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(apei_exec_run);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists