diff mbox

[1/4,Patch-next] ACPI, APEI, ERST Fix the wrong checking of Serialization Header's length

Message ID 4C69DDB5.6060103@np.css.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jin Dongming Aug. 17, 2010, 12:54 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 864dd46..28a5caf 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -358,7 +358,8 @@  static struct apei_exec_ins_type erst_ins_type[] = {
 static inline void erst_exec_ctx_init(struct apei_exec_context *ctx)
 {
 	apei_exec_ctx_init(ctx, erst_ins_type, ARRAY_SIZE(erst_ins_type),
-			   ERST_TAB_ENTRY(erst_tab), erst_tab->entries);
+			   ERST_TAB_ENTRY(erst_tab),
+			   erst_tab->seri_header.entries);
 }
 
 static int erst_get_erange(struct erst_erange *range)
@@ -749,12 +750,14 @@  __setup("erst_disable", setup_erst_disable);
 
 static int erst_check_table(struct acpi_table_erst *erst_tab)
 {
-	if (erst_tab->header_length != sizeof(struct acpi_table_erst))
+	if (erst_tab->common_header.length < sizeof(struct acpi_table_erst))
 		return -EINVAL;
-	if (erst_tab->header.length < sizeof(struct acpi_table_erst))
+
+	if (erst_tab->seri_header.length != sizeof(struct acpi_erst_header))
 		return -EINVAL;
-	if (erst_tab->entries !=
-	    (erst_tab->header.length - sizeof(struct acpi_table_erst)) /
+
+	if (erst_tab->seri_header.entries !=
+	    (erst_tab->common_header.length - sizeof(struct acpi_table_erst)) /
 	    sizeof(struct acpi_erst_entry))
 		return -EINVAL;
 
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index c637b75..821f8ac 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -283,13 +283,21 @@  enum acpi_einj_command_status {
  *
  ******************************************************************************/
 
-struct acpi_table_erst {
-	struct acpi_table_header header;	/* Common ACPI table header */
-	u32 header_length;
+/* ERST Serialization Header */
+
+struct acpi_erst_header {
+	u32 length;
 	u32 reserved;
 	u32 entries;
 };
 
+/* ERST Header */
+
+struct acpi_table_erst {
+	struct acpi_table_header common_header;	/* Common ACPI table header */
+	struct acpi_erst_header seri_header;	/* ERST Serialization Header */
+};
+
 /* ERST Serialization Entries (actions) */
 
 struct acpi_erst_entry {