summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-02-24 11:48:17 -0300
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-16 17:32:45 -0700
commit7f1c57aed4c5c3f3f61c82b4d7dc8bf8705df6f0 (patch)
tree050e4037bf1dae6125d6d55c448ae191128c2fe4
parentcbbfd37dee2249103a71accc4d1839d842473d9e (diff)
downloadkernel-common-7f1c57aed4c5c3f3f61c82b4d7dc8bf8705df6f0.tar.gz
kernel-common-7f1c57aed4c5c3f3f61c82b4d7dc8bf8705df6f0.tar.bz2
kernel-common-7f1c57aed4c5c3f3f61c82b4d7dc8bf8705df6f0.zip
ACPI: fix broken usage of name.ascii
This issue was fixed indirectly in mainline by commit 0175d562a29ad052c510782c7e76bc63d5155b9b. acpi_namespace_node's name.ascii field is four chars, and not NULL- terminated except by pure luck. So, it cannot be used by sscanf() without a length restriction. This is the minimal fix for both stable 2.6.27 and 2.6.28. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Cc: Lin Ming <ming.m.lin@intel.com> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/acpi/ec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 30f3ef236ecb..4aa9477d9822 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -759,9 +759,10 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
struct acpi_namespace_node *node = handle;
struct acpi_ec *ec = context;
int value = 0;
- if (sscanf(node->name.ascii, "_Q%x", &value) == 1) {
+
+ if (sscanf(node->name.ascii, "_Q%2x", &value) == 1)
acpi_ec_add_query_handler(ec, value, handle, NULL, NULL);
- }
+
return AE_OK;
}