lkml.org 
[lkml]   [2010]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] acpi: fix apei related table size checking
From
Date
On Sat, 2010-07-24 at 01:39 +0800, Yinghai Lu wrote: 
> also check if we can find right action in apei.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> 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;

It seems that the header_length field is not set properly by BIOS on my
testing machine which I used to develop the original code. Will try to
contact BIOS guys to make sure.

> 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;

-ENOENT is better here?

Best Regards,
Huang Ying




\
 
 \ /
  Last update: 2010-07-26 09:43    [W:0.039 / U:0.872 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site