Skip to contentSkip to conversation

ACPICA: ACPICA 20250807

PATCH New Rafael J. Wysocki 1 participant 17 messages Sep 12, 2025

Subsystems (2)
lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

cover ACPICA: ACPICA 20250807

Hi All,

This series of patches represents upstream ACPICA changes made between the 20250404 release and the 20250807 release that have not been included into the Linux source code yet, and some upstream ACPICA changes made after the 20250807 release.

It contains the following material:

Ahmed Salem (4):
ACPICA: Apply ACPI_NONSTRING
ACPICA: iASL: Fix printing CDAT table header
ACPICA: acpidump: drop ACPI_NONSTRING attribute from file_name
ACPICA: Debugger: drop ACPI_NONSTRING attribute from name_seg

Davidlohr Bueso (1):
ACPICA: CEDT: Add Back-Invalidate restriction to CXL Window

Dmitry Antipov (1):
ACPICA: Fix largest possible resource descriptor index

Hans de Goede (1):
ACPICA: dispatcher: Use acpi_ds_clear_operands() in acpi_ds_call_control_method()

Huacai Chen (1):
ACPICA: Allow to skip Global Lock initialization

Kaushlendra Kumar (1):
ACPICA: acpidump: fix return values in ap_is_valid_checksum()

Saket Dumbre (4):
ACPICA: Update dsmethod.c to get rid of unused variable warning
ACPICA: Print error messages for too few or too many arguments
ACPICA: Update version to 20250807
ACPICA: ACPI_TYPE_ANY does not include the package type

Zhe Qiao (3):
ACPICA: Modify variable definition position
ACPICA: Remove redundant "#ifdef" definitions
ACPICA: Change the compilation conditions

Thanks!

author maintainer
#1 lore raw

PATCH 1/16 ACPICA: Modify variable definition position

From: Zhe Qiao <[email protected]>

To prevent potential undefined risks.

---
 drivers/acpi/acpica/psopinfo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/acpica/psopinfo.c +4 -2
index 1c8044ffcb97..5168b4a04670 100644
@@ -35,7 +35,7 @@ static const u8 acpi_gbl_argument_count[] =
 const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
 #ifdef ACPI_DEBUG_OUTPUT
-	const char *opcode_name = "Unknown AML opcode";
+
 #endif
 
 	ACPI_FUNCTION_NAME(ps_get_opcode_info);
@@ -62,6 +62,8 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 #if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT
 #include "asldefine.h"
 
+	const char *opcode_name = "Unknown AML opcode";
+
 	switch (opcode) {
 	case AML_RAW_DATA_BYTE:
 		opcode_name = "-Raw Data Byte-";
@@ -102,11 +104,11 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 	default:
 		break;
 	}
-#endif
 
 	/* Unknown AML opcode */
 
 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%4.4X]\n", opcode_name, opcode));
+#endif
 
 	return (&acpi_gbl_aml_op_info[_UNK]);
 }
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH 2/16 ACPICA: Remove redundant "#ifdef" definitions

In reply to Rafael J. Wysocki

From: Zhe Qiao <[email protected]>

---
 drivers/acpi/acpica/psopinfo.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/acpi/acpica/psopinfo.c +0 -3
index 5168b4a04670..ca867d9407f9 100644
@@ -34,9 +34,6 @@ static const u8 acpi_gbl_argument_count[] =
 
 const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
-#ifdef ACPI_DEBUG_OUTPUT
-
-#endif
 
 	ACPI_FUNCTION_NAME(ps_get_opcode_info);
 
Signature · 1 line
2.51.0
author maintainer
#3 lore raw

PATCH 3/16 ACPICA: Change the compilation conditions

In reply to Rafael J. Wysocki

From: Zhe Qiao <[email protected]>

To prevent the risk of undefined variables.

---
 drivers/acpi/acpica/psopinfo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/acpica/psopinfo.c +3 -2
index ca867d9407f9..532ea307a675 100644
@@ -34,6 +34,9 @@ static const u8 acpi_gbl_argument_count[] =
 
 const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 {
+#if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT
+	const char *opcode_name = "Unknown AML opcode";
+#endif
 
 	ACPI_FUNCTION_NAME(ps_get_opcode_info);
 
@@ -59,8 +62,6 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
 #if defined ACPI_ASL_COMPILER && defined ACPI_DEBUG_OUTPUT
 #include "asldefine.h"
 
-	const char *opcode_name = "Unknown AML opcode";
-
 	switch (opcode) {
 	case AML_RAW_DATA_BYTE:
 		opcode_name = "-Raw Data Byte-";
Signature · 1 line
2.51.0
author maintainer
#4 lore raw

PATCH 4/16 ACPICA: Allow to skip Global Lock initialization

In reply to Rafael J. Wysocki

From: Huacai Chen <[email protected]>

Introduce acpi_gbl_use_global_lock, which allows to skip the Global Lock initialization. This is useful for systems without Global Lock (such as loong_arch), so as to avoid error messages during boot phase:

ACPI Error: Could not enable global_lock event (20240827/evxfevnt-182) ACPI Error: No response from Global Lock hardware, disabling lock (20240827/evglock-59)

---
 drivers/acpi/acpica/evglock.c | 4 ++++
 include/acpi/acpixf.h         | 6 ++++++
 2 files changed, 10 insertions(+)
drivers/acpi/acpica/evglock.c +4 -0
index fa3e0d00d1ca..df2a4ab0e0da 100644
@@ -42,6 +42,10 @@ acpi_status acpi_ev_init_global_lock_handler(void)
 		return_ACPI_STATUS(AE_OK);
 	}
 
+	if (!acpi_gbl_use_global_lock) {
+		return_ACPI_STATUS(AE_OK);
+	}
+
 	/* Attempt installation of the global lock handler */
 
 	status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
include/acpi/acpixf.h +6 -0
index b49396aa4058..97c25ae8a36e 100644
@@ -213,6 +213,12 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
  */
 ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
 
+/*
+ * ACPI Global Lock is mainly used for systems with SMM, so no-SMM systems
+ * (such as loong_arch) may not have and not use Global Lock.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use_global_lock, TRUE);
+
 /*
  * Maximum timeout for While() loop iterations before forced method abort.
  * This mechanism is intended to prevent infinite loops during interpreter
Signature · 1 line
2.51.0
author maintainer
#5 lore raw

PATCH 5/16 ACPICA: Apply ACPI_NONSTRING

In reply to Rafael J. Wysocki

From: Ahmed Salem <[email protected]>

Add ACPI_NONSTRING for destination char arrays without a terminating NUL character.

This is a follow-up to commit 2b82118845e0 ("ACPICA: Apply ACPI_NONSTRING") where a few more destination arrays were missed.

Fixes 2b82118845e0 ("ACPICA: Apply ACPI_NONSTRING")
---
 include/acpi/actbl.h                                     | 2 +-
 tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/acpi/actbl.h +1 -1
index 243097a3da63..8a67d4ea6e3f 100644
@@ -73,7 +73,7 @@ struct acpi_table_header {
 	char oem_id[ACPI_OEM_ID_SIZE] ACPI_NONSTRING;	/* ASCII OEM identification */
 	char oem_table_id[ACPI_OEM_TABLE_ID_SIZE] ACPI_NONSTRING;	/* ASCII OEM table identification */
 	u32 oem_revision;	/* OEM revision number */
-	char asl_compiler_id[ACPI_NAMESEG_SIZE];	/* ASCII ASL compiler vendor ID */
+	char asl_compiler_id[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;	/* ASCII ASL compiler vendor ID */
 	u32 asl_compiler_revision;	/* ASL compiler version */
 };
 
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +2 -2
index 9741e7503591..de93067a5da3 100644
@@ -995,7 +995,7 @@ static acpi_status osl_list_customized_tables(char *directory)
 {
 	void *table_dir;
 	u32 instance;
-	char temp_name[ACPI_NAMESEG_SIZE];
+	char temp_name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	char *filename;
 	acpi_status status = AE_OK;
 
@@ -1312,7 +1312,7 @@ osl_get_customized_table(char *pathname,
 {
 	void *table_dir;
 	u32 current_instance = 0;
-	char temp_name[ACPI_NAMESEG_SIZE];
+	char temp_name[ACPI_NAMESEG_SIZE] ACPI_NONSTRING;
 	char table_filename[PATH_MAX];
 	char *filename;
 	acpi_status status;
Signature · 1 line
2.51.0
author maintainer
#6 lore raw

PATCH 6/16 ACPICA: iASL: Fix printing CDAT table header

In reply to Rafael J. Wysocki

From: Ahmed Salem <[email protected]>

When disassembling CDAT AML, the lack of CDAT's common ACPI table header should be taken into consideration when printing the table's actual header. As the table header lacks fields like Signature, header information is mangled and incorrect:

# $ iasl -d -ds CDAT cdat.aml
# Input file cdat.aml, Length 0xE4 (228) bytes
# ACPI: ? 0x0000000000000000 000C01 (v00 ? 00180000 ?? 23456789)

Both Signature and Length are printed incorrectly, and the remaining fields are not applicable for this special table. To fix this, verify acpi_gbl_CDAT is set (<-ds CDAT> via command line) and Header->Signature is an invalid nameseg (due to the presence of non-ASCII char(s)), then print only the explicitly-passed signature (ACPI_SIG_CDAT) and the table length as cast with a pointer to the struct acpi_table_cdat structure.

---
 drivers/acpi/acpica/tbprint.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/acpi/acpica/tbprint.c +8 -0
index fd64460a2e26..049f6c2f1e32 100644
@@ -121,6 +121,14 @@ acpi_tb_print_table_header(acpi_physical_address address,
 			   ACPI_CAST_PTR(struct acpi_table_rsdp,
 					 header)->revision,
 			   local_header.oem_id));
+	} else if (acpi_gbl_CDAT && !acpi_ut_valid_nameseg(header->signature)) {
+
+		/* CDAT does not use the common ACPI table header */
+
+		ACPI_INFO(("%-4.4s 0x%8.8X%8.8X %06X",
+			   ACPI_SIG_CDAT, ACPI_FORMAT_UINT64(address),
+			   ACPI_CAST_PTR(struct acpi_table_cdat,
+					 header)->length));
 	} else {
 		/* Standard ACPI table with full common header */
 
Signature · 1 line
2.51.0
author maintainer
#7 lore raw

PATCH 7/16 ACPICA: acpidump: drop ACPI_NONSTRING attribute from file_name

In reply to Rafael J. Wysocki

From: Ahmed Salem <[email protected]>

Partially revert commit 70662db73d54 ("ACPICA: Apply ACPI_NONSTRING in more places") as I've yet again incorrectly applied the ACPI_NONSTRING attribute where it is not needed.

A warning was initially reported by Collin Funk [1], and further review by Jiri Slaby [2] highlighted another issue related to the same commit.

Drop the ACPI_NONSTRING attribute to fix the issue.

---
 tools/power/acpi/tools/acpidump/apfiles.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/acpi/tools/acpidump/apfiles.c +1 -1
index 75db0091e275..d6b8a201480b 100644
@@ -103,7 +103,7 @@ int ap_open_output_file(char *pathname)
 
 int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 {
-	char filename[ACPI_NAMESEG_SIZE + 16] ACPI_NONSTRING;
+	char filename[ACPI_NAMESEG_SIZE + 16];
 	char instance_str[16];
 	ACPI_FILE file;
 	acpi_size actual;
Signature · 1 line
2.51.0
author maintainer
#8 lore raw

PATCH 8/16 ACPICA: Debugger: drop ACPI_NONSTRING attribute from name_seg

In reply to Rafael J. Wysocki

From: Ahmed Salem <[email protected]>

ACPICA commit 4623b3369f3aa1ec5229d461e91c514510a96912

Partially revert commit 70662db73d54 ("ACPICA: Apply ACPI_NONSTRING in more places") as I've yet again incorrectly applied the ACPI_NONSTRING attribute where it is not needed.

A warning was initially reported by Collin Funk [1], and further review by Jiri Slaby [2] highlighted another issue related to the same commit.

Drop the ACPI_NONSTRING attribute to fix the issue.

---
 drivers/acpi/acpica/acdebug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/acdebug.h +1 -1
index fe6d38b43c9a..91241bd6917a 100644
@@ -37,7 +37,7 @@ struct acpi_db_argument_info {
 struct acpi_db_execute_walk {
 	u32 count;
 	u32 max_count;
-	char name_seg[ACPI_NAMESEG_SIZE + 1] ACPI_NONSTRING;
+	char name_seg[ACPI_NAMESEG_SIZE + 1];
 };
 
 #define PARAM_LIST(pl)                  pl
Signature · 1 line
2.51.0
author maintainer
#9 lore raw

PATCH 9/16 ACPICA: dispatcher: Use acpi_ds_clear_operands() in acpi_ds_call_control_method()

In reply to Rafael J. Wysocki

From: Hans de Goede <[email protected]>

When deleting the previous walkstate operand stack acpi_ds_call_control_method() was deleting obj_desc->Method.param_count operands. But Method.param_count does not necessarily match this_walk_state->num_operands, it may be either less or more.

After correcting the for loop to check i < this_walk_state->num_operands the code is identical to acpi_ds_clear_operands(), so just outright replace the code with acpi_ds_clear_operands() to fix this.

---
 drivers/acpi/acpica/dsmethod.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/acpi/acpica/dsmethod.c +1 -8
index fef6fb29ece4..e707a7036802 100644
@@ -546,14 +546,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
 	 * Delete the operands on the previous walkstate operand stack
 	 * (they were copied to new objects)
 	 */
-	for (i = 0; i < obj_desc->method.param_count; i++) {
-		acpi_ut_remove_reference(this_walk_state->operands[i]);
-		this_walk_state->operands[i] = NULL;
-	}
-
-	/* Clear the operand stack */
-
-	this_walk_state->num_operands = 0;
+	acpi_ds_clear_operands(this_walk_state);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
 			  "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
Signature · 1 line
2.51.0
author maintainer
#10 lore raw

PATCH 10/16 ACPICA: Update dsmethod.c to get rid of unused variable warning

In reply to Rafael J. Wysocki

From: Saket Dumbre <[email protected]>

All the 3 major C compilers (MSVC, GCC, LLVM/Clang) warn about the unused variable i after the removal of its usage by PR #1031 addressing Issue #1027

---
 drivers/acpi/acpica/dsmethod.c | 1 -
 1 file changed, 1 deletion(-)
drivers/acpi/acpica/dsmethod.c +0 -1
index e707a7036802..b2f756b7078d 100644
@@ -462,7 +462,6 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
 	struct acpi_walk_state *next_walk_state = NULL;
 	union acpi_operand_object *obj_desc;
 	struct acpi_evaluate_info *info;
-	u32 i;
 
 	ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state);
 
Signature · 1 line
2.51.0
author maintainer
#11 lore raw

PATCH 11/16 ACPICA: Print error messages for too few or too many arguments

In reply to Rafael J. Wysocki

From: Saket Dumbre <[email protected]>

Fix Issue #1027 by displaying error messages when there are too few or too many arguments in the caller vs the definition of an ASL/AML method.

---
 drivers/acpi/acpica/dsmethod.c | 11 +++++++++--
 include/acpi/acexcep.h         | 10 ++++++++--
 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/acpi/acpica/dsmethod.c +9 -2
index b2f756b7078d..45ec32e81903 100644
@@ -483,10 +483,17 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
 	}
 
 	if (this_walk_state->num_operands < obj_desc->method.param_count) {
-		ACPI_ERROR((AE_INFO, "Missing argument for method [%4.4s]",
+		ACPI_ERROR((AE_INFO, "Missing argument(s) for method [%4.4s]",
 			    acpi_ut_get_node_name(method_node)));
 
-		return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
+		return_ACPI_STATUS(AE_AML_TOO_FEW_ARGUMENTS);
+	}
+
+	else if (this_walk_state->num_operands > obj_desc->method.param_count) {
+		ACPI_ERROR((AE_INFO, "Too many arguments for method [%4.4s]",
+			    acpi_ut_get_node_name(method_node)));
+
+		return_ACPI_STATUS(AE_AML_TOO_MANY_ARGUMENTS);
 	}
 
 	/* Init for new method, possibly wait on method mutex */
include/acpi/acexcep.h +8 -2
index 53c98f5fe3c3..a2db36d18419 100644
@@ -173,8 +173,10 @@ struct acpi_exception_info {
 #define AE_AML_TARGET_TYPE              EXCEP_AML (0x0023)
 #define AE_AML_PROTOCOL                 EXCEP_AML (0x0024)
 #define AE_AML_BUFFER_LENGTH            EXCEP_AML (0x0025)
+#define AE_AML_TOO_FEW_ARGUMENTS        EXCEP_AML (0x0026)
+#define AE_AML_TOO_MANY_ARGUMENTS       EXCEP_AML (0x0027)
 
-#define AE_CODE_AML_MAX                 0x0025
+#define AE_CODE_AML_MAX                 0x0027
 
 /*
  * Internal exceptions used for control
@@ -353,7 +355,11 @@ static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
 		  "A target operand of an incorrect type was encountered"),
 	EXCEP_TXT("AE_AML_PROTOCOL", "Violation of a fixed ACPI protocol"),
 	EXCEP_TXT("AE_AML_BUFFER_LENGTH",
-		  "The length of the buffer is invalid/incorrect")
+		  "The length of the buffer is invalid/incorrect"),
+	EXCEP_TXT("AE_AML_TOO_FEW_ARGUMENTS",
+		  "There are fewer than expected method arguments"),
+	EXCEP_TXT("AE_AML_TOO_MANY_ARGUMENTS",
+		  "There are too many arguments for this method")
 };
 
 static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {
Signature · 1 line
2.51.0
author maintainer
#12 lore raw

PATCH 12/16 ACPICA: Update version to 20250807

In reply to Rafael J. Wysocki

From: Saket Dumbre <[email protected]>

---
 include/acpi/acpixf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index 97c25ae8a36e..e65a2afe9250 100644
@@ -12,7 +12,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20250404
+#define ACPI_CA_VERSION                 0x20250807
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
2.51.0
author maintainer
#13 lore raw

PATCH 13/16 ACPICA: Fix largest possible resource descriptor index

In reply to Rafael J. Wysocki

From: Dmitry Antipov <[email protected]>

ACPI_RESOURCE_NAME_LARGE_MAX should be equal to the last actually used resource descriptor index (ACPI_RESOURCE_NAME_CLOCK_INPUT).

Otherwise 'resource_index' in 'acpi_ut_validate_resource()' may be clamped incorrectly and resulting value may issue an out-of-bounds access for 'acpi_gbl_resource_types' array. Compile tested only.

---
 drivers/acpi/acpica/aclocal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/aclocal.h +1 -1
index 0c41f0097e8d..f98640086f4e 100644
@@ -1141,7 +1141,7 @@ struct acpi_port_info {
 #define ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION   0x91
 #define ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG     0x92
 #define ACPI_RESOURCE_NAME_CLOCK_INPUT          0x93
-#define ACPI_RESOURCE_NAME_LARGE_MAX            0x94
+#define ACPI_RESOURCE_NAME_LARGE_MAX            0x93
 
 /*****************************************************************************
  *
Signature · 1 line
2.51.0
author maintainer
#14 lore raw

PATCH 14/16 ACPICA: CEDT: Add Back-Invalidate restriction to CXL Window

In reply to Rafael J. Wysocki

From: Davidlohr Bueso <[email protected]>

This is added in newer version (3.0+) of the CXL Spec to support the HDM-DB coherency model.

---
 include/acpi/actbl1.h | 1 +
 1 file changed, 1 insertion(+)
include/acpi/actbl1.h +1 -0
index 99fd1588ff38..0b4c332df25c 100644
@@ -565,6 +565,7 @@ struct acpi_cedt_cfmws_target_element {
 #define ACPI_CEDT_CFMWS_RESTRICT_VOLATILE   (1<<2)
 #define ACPI_CEDT_CFMWS_RESTRICT_PMEM       (1<<3)
 #define ACPI_CEDT_CFMWS_RESTRICT_FIXED      (1<<4)
+#define ACPI_CEDT_CFMWS_RESTRICT_BI         (1<<5)
 
 /* 2: CXL XOR Interleave Math Structure */
 
Signature · 1 line
2.51.0
author maintainer
#15 lore raw

PATCH 15/16 ACPICA: ACPI_TYPE_ANY does not include the package type

In reply to Rafael J. Wysocki

From: Saket Dumbre <[email protected]>

So add it to the list of acceptable Arg3 types for _DSM.

---
 drivers/acpi/acpica/acpredef.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/acpica/acpredef.h +2 -1
index 76c5ed02e916..da2c45880cc7 100644
@@ -450,7 +450,8 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
 
 	{{"_DSM",
 	  METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
-		       ACPI_TYPE_ANY) | ARG_COUNT_IS_MINIMUM,
+		       ACPI_TYPE_ANY | ACPI_TYPE_PACKAGE) |
+		       ARG_COUNT_IS_MINIMUM,
 	  METHOD_RETURNS(ACPI_RTYPE_ALL)}},	/* Must return a value, but it can be of any type */
 
 	{{"_DSS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
Signature · 1 line
2.51.0
author maintainer
#16 lore raw

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

In reply to Rafael J. Wysocki

From: Kaushlendra Kumar <[email protected]>

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