* [PATCH] ACPI: index off by one?
@ 2009-02-22 1:54 Roel Kluin
2009-02-23 15:36 ` Moore, Robert
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-02-22 1:54 UTC (permalink / raw)
To: lenb; +Cc: linux-acpi, Andrew Morton
Should maybe this be applied? please review.
--------------------------->8-------------8<------------------------------
When index equals ACPI_NAME_SIZE, that is still one too large.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index ae3dc10..232c80c 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -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 */
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] ACPI: index off by one?
2009-02-22 1:54 [PATCH] ACPI: index off by one? Roel Kluin
@ 2009-02-23 15:36 ` Moore, Robert
0 siblings, 0 replies; 2+ messages in thread
From: Moore, Robert @ 2009-02-23 15:36 UTC (permalink / raw)
To: Roel Kluin, lenb@kernel.org; +Cc: linux-acpi@vger.kernel.org, Andrew Morton
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
>-----Original Message-----
>From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>owner@vger.kernel.org] On Behalf Of Roel Kluin
>Sent: Saturday, February 21, 2009 5:54 PM
>To: lenb@kernel.org
>Cc: linux-acpi@vger.kernel.org; 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.
>
>Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>---
>diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
>index ae3dc10..232c80c 100644
>--- a/drivers/acpi/acpica/nsnames.c
>+++ b/drivers/acpi/acpica/nsnames.c
>@@ -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 majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-23 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-22 1:54 [PATCH] ACPI: index off by one? Roel Kluin
2009-02-23 15:36 ` Moore, Robert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox