Skip to contentSkip to conversation

ACPI/APEI: fix error status check condition for CPER

PATCH Applied Chen Gong 3 participants 3 messages Mar 19, 2013 – Mar 26, 2013

Subsystems (2)
lore
Share & tools
lore

Chen Gong

author
#0 lore raw

PATCH 1/1 ACPI/APEI: fix error status check condition for CPER

In Table 18-289, ACPI5.0 SPEC, the error data length in CPER Generic Error Data Entry can be 0, which means this generic error data entry can have only one header. So fix the check conditon for it.

---
 drivers/acpi/apei/cper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/cper.c +1 -1
index 1e5d8a4..fefc2ca 100644
@@ -405,7 +405,7 @@ int apei_estatus_check(const struct acpi_hest_generic_status *estatus)
 		return rc;
 	data_len = estatus->data_length;
 	gdata = (struct acpi_hest_generic_data *)(estatus + 1);
-	while (data_len > sizeof(*gdata)) {
+	while (data_len >= sizeof(*gdata)) {
 		gedata_len = gdata->error_data_length;
 		if (gedata_len > data_len - sizeof(*gdata))
 			return -EINVAL;
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Chen Gong

In Table 18-289, ACPI5.0 SPEC, the error data length in CPER Generic Error Data Entry can be 0, which means this generic error data entry can have only one header. So fix the check conditon for it.

Good catch!

Quoted 17 lines
---
 drivers/acpi/apei/cper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/cper.c +1 -1
index 1e5d8a4..fefc2ca 100644
@@ -405,7 +405,7 @@ int apei_estatus_check(const struct acpi_hest_generic_status *estatus)
 		return rc;
 	data_len = estatus->data_length;
 	gdata = (struct acpi_hest_generic_data *)(estatus + 1);
-	while (data_len > sizeof(*gdata)) {
+	while (data_len >= sizeof(*gdata)) {
 		gedata_len = gdata->error_data_length;
 		if (gedata_len > data_len - sizeof(*gdata))
 			return -EINVAL;
#2 lore raw
Quoted 11 lines · Huang Ying
Quoted 6 lines · Chen Gong

In Table 18-289, ACPI5.0 SPEC, the error data length in CPER Generic Error Data Entry can be 0, which means this generic error data entry can have only one header. So fix the check conditon for it.

Good catch!

Applied. I'm going to push it for 3.9.

Thanks,
Rafael

Quoted 23 lines
Quoted 9 lines
---
 drivers/acpi/apei/cper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/apei/cper.c +0 -0
index 1e5d8a4..fefc2ca 100644

drivers/acpi/apei/cper.c int apei_estatus_check(const struct acpi_hest_generic_status *estatus) · line 411

Quoted 8 lines
drivers/acpi/apei/cper.c +1 -1
@@ -405,7 +405,7 @@ int apei_estatus_check(const struct acpi_hest_generic_status *estatus)
 		return rc;
 	data_len = estatus->data_length;
 	gdata = (struct acpi_hest_generic_data *)(estatus + 1);
-	while (data_len > sizeof(*gdata)) {
+	while (data_len >= sizeof(*gdata)) {
 		gedata_len = gdata->error_data_length;
 		if (gedata_len > data_len - sizeof(*gdata))
 			return -EINVAL;

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.