diff options
author | Bob Moore <robert.moore@intel.com> | 2013-05-29 22:00:01 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-01 15:54:30 -0400 |
commit | 29a241cc02110b8b2259fd72719b8cadc03909be (patch) | |
tree | a96c10dd22a35479dc2e1ef140f7d90a442f9c03 /drivers/acpi/acpica/utpredef.c | |
parent | e1405ca5ebf1068a0d62afd2fec8f0354038147a (diff) |
ACPICA: Add argument typechecking for all predefined ACPI names
Fully implements typechecking on all incoming arguments for all
predefined names. This ensures that ACPI-related drivers are
passing the correct number of arguments, each of the correct
object type.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/utpredef.c')
-rw-r--r-- | drivers/acpi/acpica/utpredef.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c index 29459479148f..2b1ce4cd3207 100644 --- a/drivers/acpi/acpica/utpredef.c +++ b/drivers/acpi/acpica/utpredef.c | |||
@@ -147,6 +147,11 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes) | |||
147 | u32 i; | 147 | u32 i; |
148 | u32 j; | 148 | u32 j; |
149 | 149 | ||
150 | if (!expected_btypes) { | ||
151 | ACPI_STRCPY(buffer, "NONE"); | ||
152 | return; | ||
153 | } | ||
154 | |||
150 | j = 1; | 155 | j = 1; |
151 | buffer[0] = 0; | 156 | buffer[0] = 0; |
152 | this_rtype = ACPI_RTYPE_INTEGER; | 157 | this_rtype = ACPI_RTYPE_INTEGER; |
@@ -328,9 +333,7 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types) | |||
328 | 333 | ||
329 | /* First field in the types list is the count of args to follow */ | 334 | /* First field in the types list is the count of args to follow */ |
330 | 335 | ||
331 | arg_count = (argument_types & METHOD_ARG_MASK); | 336 | arg_count = METHOD_GET_ARG_COUNT(argument_types); |
332 | argument_types >>= METHOD_ARG_BIT_WIDTH; | ||
333 | |||
334 | if (arg_count > METHOD_PREDEF_ARGS_MAX) { | 337 | if (arg_count > METHOD_PREDEF_ARGS_MAX) { |
335 | printf("**** Invalid argument count (%u) " | 338 | printf("**** Invalid argument count (%u) " |
336 | "in predefined info structure\n", arg_count); | 339 | "in predefined info structure\n", arg_count); |
@@ -340,7 +343,8 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types) | |||
340 | /* Get each argument from the list, convert to ascii, store to buffer */ | 343 | /* Get each argument from the list, convert to ascii, store to buffer */ |
341 | 344 | ||
342 | for (i = 0; i < arg_count; i++) { | 345 | for (i = 0; i < arg_count; i++) { |
343 | this_argument_type = (argument_types & METHOD_ARG_MASK); | 346 | this_argument_type = METHOD_GET_NEXT_TYPE(argument_types); |
347 | |||
344 | if (!this_argument_type | 348 | if (!this_argument_type |
345 | || (this_argument_type > METHOD_MAX_ARG_TYPE)) { | 349 | || (this_argument_type > METHOD_MAX_ARG_TYPE)) { |
346 | printf("**** Invalid argument type (%u) " | 350 | printf("**** Invalid argument type (%u) " |
@@ -351,10 +355,6 @@ static u32 acpi_ut_get_argument_types(char *buffer, u16 argument_types) | |||
351 | 355 | ||
352 | strcat(buffer, | 356 | strcat(buffer, |
353 | ut_external_type_names[this_argument_type] + sub_index); | 357 | ut_external_type_names[this_argument_type] + sub_index); |
354 | |||
355 | /* Shift to next argument type field */ | ||
356 | |||
357 | argument_types >>= METHOD_ARG_BIT_WIDTH; | ||
358 | sub_index = 0; | 358 | sub_index = 0; |
359 | } | 359 | } |
360 | 360 | ||