public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Huang Ying <ying.huang@intel.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>, Andi Kleen <ak@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Tejun Heo <tj@kernel.org>,
	Daniel J Blueman <daniel.blueman@gmail.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] acpi: fix apei related table size checking
Date: Mon, 26 Jul 2010 15:41:39 +0800	[thread overview]
Message-ID: <1280130099.2771.150.camel@yhuang-dev> (raw)
In-Reply-To: <4C49D3C5.4000007@kernel.org>

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



      parent reply	other threads:[~2010-07-26  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 17:39 [PATCH] acpi: fix apei related table size checking Yinghai Lu
2010-07-26  4:23 ` Bjorn Helgaas
2010-07-26  7:13   ` Andi Kleen
2010-07-26  7:41 ` Huang Ying [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280130099.2771.150.camel@yhuang-dev \
    --to=ying.huang@intel.com \
    --cc=ak@linux.intel.com \
    --cc=daniel.blueman@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tj@kernel.org \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox