diff options
author | Bob Moore <robert.moore@intel.com> | 2008-08-03 23:13:01 -0400 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2008-08-14 20:12:16 -0400 |
commit | 3c7db22a194d3b53584047425af82b4e1e03d9f7 (patch) | |
tree | 96462093e2826ca81641ccef7ae5718ce2b9c9bb /drivers/acpi/utilities | |
parent | d3ff268a0149fce8835f6d48ab481d5e3321e0f7 (diff) |
ACPICA: Additional error checking for pathname utilities
Add error check after all calls to acpi_ns_get_pathname_length.
Add status return from acpi_ns_build_external_path and check after
all calls. Add parameter validation to acpi_ut_initialize_buffer.
Reported by and initial patch by Ingo Molnar.
http://lkml.org/lkml/2008/7/21/176
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r-- | drivers/acpi/utilities/utalloc.c | 8 | ||||
-rw-r--r-- | drivers/acpi/utilities/utobject.c | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index e7bf34a7b1d2..7dcb67e0b215 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -242,10 +242,12 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
242 | { | 242 | { |
243 | acpi_status status = AE_OK; | 243 | acpi_status status = AE_OK; |
244 | 244 | ||
245 | if (!required_length) { | 245 | /* Parameter validation */ |
246 | WARN_ON(1); | 246 | |
247 | return AE_ERROR; | 247 | if (!buffer || !required_length) { |
248 | return (AE_BAD_PARAMETER); | ||
248 | } | 249 | } |
250 | |||
249 | switch (buffer->length) { | 251 | switch (buffer->length) { |
250 | case ACPI_NO_BUFFER: | 252 | case ACPI_NO_BUFFER: |
251 | 253 | ||
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index e25484495e65..916eff399eb3 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -425,6 +425,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
425 | acpi_size * obj_length) | 425 | acpi_size * obj_length) |
426 | { | 426 | { |
427 | acpi_size length; | 427 | acpi_size length; |
428 | acpi_size size; | ||
428 | acpi_status status = AE_OK; | 429 | acpi_status status = AE_OK; |
429 | 430 | ||
430 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); | 431 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); |
@@ -484,10 +485,14 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
484 | * Get the actual length of the full pathname to this object. | 485 | * Get the actual length of the full pathname to this object. |
485 | * The reference will be converted to the pathname to the object | 486 | * The reference will be converted to the pathname to the object |
486 | */ | 487 | */ |
487 | length += | 488 | size = |
488 | ACPI_ROUND_UP_TO_NATIVE_WORD | 489 | acpi_ns_get_pathname_length(internal_object-> |
489 | (acpi_ns_get_pathname_length | 490 | reference.node); |
490 | (internal_object->reference.node)); | 491 | if (!size) { |
492 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
493 | } | ||
494 | |||
495 | length += ACPI_ROUND_UP_TO_NATIVE_WORD(size); | ||
491 | break; | 496 | break; |
492 | 497 | ||
493 | default: | 498 | default: |