linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Allow empty Trigger Error Action Table
@ 2012-01-09 15:49 Niklas Söderlund
  2012-01-09 15:49 ` [PATCH] ACPI, APEI, EINJ " Niklas Söderlund
  0 siblings, 1 reply; 4+ messages in thread
From: Niklas Söderlund @ 2012-01-09 15:49 UTC (permalink / raw)
  To: lenb, ying.huang, akpm; +Cc: linux-acpi, linux-kernel

When troubleshooting some BIOS code I encounter strange errors about firmware bugs. On closer inspection I found that the Trigger table returned from the firmware was empty but the header looked OK:

header_size = 16
table_size = 16
entry_count = 0

When looking at einj.c I found that this header would result in the error I was receiving. I took a quick look at the docs and from what I can tell this is a valid header, yes?

I don't know much about ACPI so I might be way off but the attached patch fix the error message for me (however I still can't detect the injected error but that might depend on my detection code or buggy firmware...)

Thanks
// Niklas


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

* [PATCH] ACPI, APEI, EINJ Allow empty Trigger Error Action Table
  2012-01-09 15:49 [RFC] Allow empty Trigger Error Action Table Niklas Söderlund
@ 2012-01-09 15:49 ` Niklas Söderlund
  2012-01-18  4:08   ` Huang Ying
  0 siblings, 1 reply; 4+ messages in thread
From: Niklas Söderlund @ 2012-01-09 15:49 UTC (permalink / raw)
  To: lenb, ying.huang, akpm; +Cc: linux-acpi, linux-kernel, Niklas Söderlund

According to the ACPI spec [1] section 18.6.4 the TRIGGER_ERROR action
table can consists of zero elements.

[1] Advanced Configuration and Power Interface Specification
    Revision 5.0, December 6, 2011
	http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

Signed-off-by: Niklas Söderlund <niklas.soderlund@ericsson.com>
---
 drivers/acpi/apei/einj.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 589b96c..94c05ff 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -184,7 +184,7 @@ static int einj_check_trigger_header(struct acpi_einj_trigger *trigger_tab)
 	if (trigger_tab->header_size != sizeof(struct acpi_einj_trigger))
 		return -EINVAL;
 	if (trigger_tab->table_size > PAGE_SIZE ||
-	    trigger_tab->table_size <= trigger_tab->header_size)
+	    trigger_tab->table_size < trigger_tab->header_size)
 		return -EINVAL;
 	if (trigger_tab->entry_count !=
 	    (trigger_tab->table_size - trigger_tab->header_size) /
@@ -225,6 +225,11 @@ static int __einj_error_trigger(u64 trigger_paddr)
 			   "The trigger error action table is invalid\n");
 		goto out_rel_header;
 	}
+
+	/* No action structures in the TRIGGER_ERROR table, nothing to do */
+	if (!trigger_tab->entry_count)
+		goto out_rel_header;
+
 	rc = -EIO;
 	table_size = trigger_tab->table_size;
 	r = request_mem_region(trigger_paddr + sizeof(*trigger_tab),
-- 
1.7.8.3


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

* Re: [PATCH] ACPI, APEI, EINJ Allow empty Trigger Error Action Table
  2012-01-09 15:49 ` [PATCH] ACPI, APEI, EINJ " Niklas Söderlund
@ 2012-01-18  4:08   ` Huang Ying
  2012-01-18 17:31     ` Len Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Huang Ying @ 2012-01-18  4:08 UTC (permalink / raw)
  To: Niklas Söderlund; +Cc: lenb, akpm, linux-acpi, linux-kernel

On Mon, 2012-01-09 at 16:49 +0100, Niklas Söderlund wrote:
> According to the ACPI spec [1] section 18.6.4 the TRIGGER_ERROR action
> table can consists of zero elements.
> 
> [1] Advanced Configuration and Power Interface Specification
>     Revision 5.0, December 6, 2011
> 	http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ericsson.com>

Acked-by: Huang Ying <ying.huang@intel.com>

Best Regards,
Huang Ying



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

* Re: [PATCH] ACPI, APEI, EINJ Allow empty Trigger Error Action Table
  2012-01-18  4:08   ` Huang Ying
@ 2012-01-18 17:31     ` Len Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Len Brown @ 2012-01-18 17:31 UTC (permalink / raw)
  To: Huang Ying; +Cc: Niklas Söderlund, akpm, linux-acpi, linux-kernel

Applied.

thanks,
Len Brown, Intel Open Source Technology Center

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

end of thread, other threads:[~2012-01-18 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-09 15:49 [RFC] Allow empty Trigger Error Action Table Niklas Söderlund
2012-01-09 15:49 ` [PATCH] ACPI, APEI, EINJ " Niklas Söderlund
2012-01-18  4:08   ` Huang Ying
2012-01-18 17:31     ` Len Brown

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).