Skip to contentSkip to conversation

ACPICA: acpidump: fix return values in ap_is_valid_checksum()

PATCH In review Kaushlendra Kumar 2 participants 2 messages Aug 29, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPICA: acpidump: fix return values in ap_is_valid_checksum()

The function ap_is_valid_checksum() has a boolean name suggesting it should return TRUE/FALSE, but incorrectly returns AE_OK on success and has no explicit return on failure, leading to undefined behavior.

Fix by returning proper values:
- FALSE when checksum validation fails
- TRUE when checksum validation succeeds

---
 tools/power/acpi/tools/acpidump/apdump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/power/acpi/tools/acpidump/apdump.c +2 -1
index bf30143efbdc..7a6223aa703c 100644
@@ -86,9 +86,10 @@ u8 ap_is_valid_checksum(struct acpi_table_header *table)
 	if (ACPI_FAILURE(status)) {
 		fprintf(stderr, "%4.4s: Warning: wrong checksum in table\n",
 			table->signature);
+		return (FALSE);
 	}
 
-	return (AE_OK);
+	return (TRUE);
 }
 
 /******************************************************************************
Signature · 1 line
2.34.1
#1 lore raw
Quoted 10 lines · Kaushlendra Kumar

The function ap_is_valid_checksum() has a boolean name suggesting it should return TRUE/FALSE, but incorrectly returns AE_OK on success and has no explicit return on failure, leading to undefined behavior.

Fix by returning proper values:
- FALSE when checksum validation fails
- TRUE when checksum validation succeeds

Please submit ACPICA changes to the upstream ACPICA project on GitHub.

They are not going to be applied directly to the Linux kernel code unless they are based on existing upstream ACPICA commits.

Quoted 23 lines
---
 tools/power/acpi/tools/acpidump/apdump.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/power/acpi/tools/acpidump/apdump.c +2 -2
index bf30143efbdc..7a6223aa703c 100644
@@ -86,9 +86,10 @@ u8 ap_is_valid_checksum(struct acpi_table_header *table)
        if (ACPI_FAILURE(status)) {
                fprintf(stderr, "%4.4s: Warning: wrong checksum in table\n",
                        table->signature);
+               return (FALSE);
        }
 
-       return (AE_OK);
+       return (TRUE);
 }
 
 /******************************************************************************
--

2.34.1