Skip to contentSkip to conversation

ACPI: index off by one?

PATCH In review Roel Kluin 2 participants 2 messages Feb 22, 2009 – Feb 23, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 ACPI: index off by one?

Should maybe this be applied? please review. --------------------------->8-------------8<------------------------------ When index equals ACPI_NAME_SIZE, that is still one too large.

---

drivers/acpi/acpica/nsnames.c +1 -1
index ae3dc10..232c80c 100644
@@ -87,7 +87,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
 	parent_node = node;
 	name_buffer[index] = 0;
 
-	while ((index > ACPI_NAME_SIZE) && (parent_node != acpi_gbl_root_node)) {
+	while ((index >= ACPI_NAME_SIZE) && (parent_node != acpi_gbl_root_node)) {
 		index -= ACPI_NAME_SIZE;
 
 		/* Put the name into the buffer */
#1 lore raw

No, the original code is correct.

Index must be at least as long as (ACPI_NAME_SIZE + 1) in order to account for the path separator. In other words, each segment in the pathname is not of length ACPI_NAME_SIZE, it is of length (ACPI_NAME_SIZE + 1).

Bob

Quoted 34 lines

-----Original Message-----
From: [email protected] [mailto:linux-acpi- [email protected]] On Behalf Of Roel Kluin
Sent: Saturday, February 21, 2009 5:54 PM
To: [email protected]
Cc: [email protected]; Andrew Morton
Subject: [PATCH] ACPI: index off by one?

Should maybe this be applied? please review. --------------------------->8-------------8<------------------------------ When index equals ACPI_NAME_SIZE, that is still one too large.

---

drivers/acpi/acpica/nsnames.c +1 -1
index ae3dc10..232c80c 100644
@@ -87,7 +87,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node
 *node,
 	parent_node = node;
 	name_buffer[index] = 0;
 
-	while ((index > ACPI_NAME_SIZE) && (parent_node !=
 acpi_gbl_root_node)) {
+	while ((index >= ACPI_NAME_SIZE) && (parent_node !=
 acpi_gbl_root_node)) {
		index -= ACPI_NAME_SIZE;

		/* Put the name into the buffer */

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